Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[SOLVED] How to resize Taskbar?


  • Please log in to reply
11 replies to this topic
HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007
It seems that the Windows XP Taskbar is immune to the WinMove command.
It doesn't matter if it is locked or not.

I use the Taskbar in vertical position and I want to change it's width.

Here are the basics, you can change the WinMove params to see the effect:
WinGetPos tb_X, tb_Y, tb_Width, tb_Height, ahk_class Shell_TrayWnd
WinMove ahk_class Shell_TrayWnd, , %tb_X%, %tb_Y%, %tb_Width%, %tb_Height%
I hope you can come up with an idea on how to resize the Taskbar because it doesn't work for me.

wOxxOm
  • Members
  • 371 posts
  • Last active: Feb 20 2015 12:10 PM
  • Joined: 09 Feb 2006
how about emulating over-the-edge mouse hover, click-and-hold, move, release...

HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007

how about emulating over-the-edge mouse hover, click-and-hold, move, release...

Nice hack, but my Taskbar is locked, so I cannot resize it with mouse.

The workaround would be to unlock Taskbar, resize with mouse and unlock taskbar.

This would solve the problem but it is overkill and causes so much flickering to the desktop that it would be extremely annoying.

wOxxOm
  • Members
  • 371 posts
  • Last active: Feb 20 2015 12:10 PM
  • Joined: 09 Feb 2006
dig deeper :-) Manipulating The Windows Taskbar - 424 "Locks the taskbar", maybe it'll help

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007
You may try the following, may resize the taskbar with a few key presses even if it's locked.
idx   := 2	; 0-based index of the item

WinGet, hWnd, ID, ahk_class Shell_TrayWnd
hMenu := DllCall("GetSystemMenu", "Uint", hWnd, "int", False)
idn   := DllCall("GetMenuItemID", "Uint", hMenu, "int", idx)
WinActivate, ahk_id %hWnd%
PostMessage, 0x112, idn, 0, , ahk_id %hWnd%	; WM_SYSCOMMAND


HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007

dig deeper :-) Manipulating The Windows Taskbar - 424 "Locks the taskbar", maybe it'll help

This list is very interesting on it's own but I'm afraid I doesn't help.

So I need a resize method without affecting the "lockness" :) of the Taskbar.

HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007

You may try the following, may resize the taskbar with a few key presses even if it's locked.

idx   := 2	; 0-based index of the item

WinGet, hWnd, ID, ahk_class Shell_TrayWnd
hMenu := DllCall("GetSystemMenu", "Uint", hWnd, "int", False)
idn   := DllCall("GetMenuItemID", "Uint", hMenu, "int", idx)
WinActivate, ahk_id %hWnd%
PostMessage, 0x112, idn, 0, , ahk_id %hWnd%	; WM_SYSCOMMAND

I tried this but nothing has happened.
Are you sure that the the "idn" in PostMessage is fine as naked?
I mean the syntax should be %idn%, or doesn't it?
Well I tried this way too but again nothing happened.

wOxxOm
  • Members
  • 371 posts
  • Last active: Feb 20 2015 12:10 PM
  • Joined: 09 Feb 2006

So I need a resize method without affecting the "lockness" :) of the Taskbar.

IMO being done through SendMessage the taskbar unlocking/locking won't create any visual hassle, so it seems to me a good workaround: unlock, resize (which otherwise won't do), lock.

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

I tried this but nothing has happened.

How many times have you pressed the arrow keys?
As Taskbar isn't resized incrementally, you won't notice the effect until several presses of the key.
BTW, the idn of the SysCommand is pretty constant, so you may try it instead:
WinActivate, ahk_class Shell_TrayWnd  ; may be needed if auto-hide is on
PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE


HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007

How many times have you pressed the arrow keys?
As Taskbar isn't resized incrementally, you won't notice the effect until several presses of the key.
BTW, the idn of the SysCommand is pretty constant, so you may try it instead:

WinActivate, ahk_class Shell_TrayWnd  ; may be needed if auto-hide is on
PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE

IT HAS THE EFFECT!!!

Your previous script didn't worked, but now this works.

If I press the arrow key once then the size jumps by about 10 pixels.
But if I press Ctrl+Arrow then I can resize it by one pixel.

Thank you very much.

svi
  • Members
  • 237 posts
  • Last active: Mar 09 2015 06:34 PM
  • Joined: 09 Oct 2006

how about emulating over-the-edge mouse hover, click-and-hold, move, release...

Quite few seem to know that pressing Win-key (or Ctrl+Esc, or activating the taskbar by other means) and then pressing Alt+Space opens the same menu as Alt+Space on other windows, with options Move, Resize, Close ("Close" closes the taskbar and opens a shutdown dialog).
Doesn't naturally work when locked, and few tests have shown that Resize doesn't always work properly (for me).
But PostMessage seems to be similar: some times the taskbar can be made smaller only by pressing "up" (taskbar on lower edge) and when cancelling (Esc) the taskbar minimizes (to unvisible) only (not before) then.

The (mentioned) PostMessage is in principal same as Alt + Space and resembles WinMove or ControlMove, but I couldn't make ControlMove to move taskbar either because it needs a control name or control's HWND, so it can't move the whole window, I guess ...

By the way, if you want to move taskbar (also locked) use 0xF010 instead of 0xF000. Use mouse after the first key press to test (to not to have to press tens of times or wait for key repetation).

(Text in italic may be "not the best possible expression")
Pekka Vartto

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Your previous script didn't worked, but now this works.

Then, the position of Size item in the system menu of the taskbar looks like not third (idx := 2) in your system.