Discussion:
How to move/resize/reposition taskbar by code in win XP
(too old to reply)
v***@hotmail.com
2010-01-15 03:42:04 UTC
Permalink
Dear everyone,

I was trying to write some code to change size and/or position of taskbar in
WinXP. At first I think it's just a regular window so I tried:

HWND hwnd = FindWindow("Shell_TrayWnd", NULL);
MoveWindow(hwnd, a,b,c,d, TRUE); //a,b,c,d are desided position and size

But it doesn't work. Later on I noticed that I should use some
shellappmessage thus came up the following code:

APPBARDATA appBarData;
appBarData.cbSize = sizeof(appBarData); appBarData.hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
appBarData.uEdge = ABE_BOTTOM;
appBarData.rc.left = -2;
appBarData.rc.top = -2;
appBarData.rc.right = 1026;
appBarData.rc.bottom = 57;
SHAppBarMessage(ABM_SETPOS, &appBarData);
MoveWindow(hwnd, a,b,c,d, TRUE); //a,b,c,d are desided position and size

However, the code still doesn't work at all. Microsoft seems to prevent
people change size/position of taskbar.

How can I do that? Any help is appreciated.


Thanks,
Vince
Seetharam
2010-01-15 14:37:28 UTC
Permalink
What you've done seems to be in the right direction.

At least this article does something similar ( ABM_SETPOS, followed
by a SetWindowPos() ).
http://www.microsoft.com/msj/archive/s274.aspx

-Seetharam
Vince
2010-01-15 15:41:58 UTC
Permalink
The code simply doesn't work. To make sure I call them correctly, I tried
ShappbarMessage(ABM_SETSTATE.....) and I'm able to change autohide and
alwaysontop property of the taskbar, so the hwnd and way to call function
should be correct.

Any one has done this before?

Thanks,
Vince
Post by Seetharam
What you've done seems to be in the right direction.
At least this article does something similar ( ABM_SETPOS, followed
by a SetWindowPos() ).
http://www.microsoft.com/msj/archive/s274.aspx
-Seetharam
Alexander Grigoriev
2010-01-16 17:06:15 UTC
Permalink
First question: why do you think you need to do that, behind the user's
back?
Post by v***@hotmail.com
Dear everyone,
I was trying to write some code to change size and/or position of taskbar
HWND hwnd = FindWindow("Shell_TrayWnd", NULL);
MoveWindow(hwnd, a,b,c,d, TRUE); //a,b,c,d are desided position and size
But it doesn't work. Later on I noticed that I should use some
APPBARDATA appBarData;
appBarData.cbSize = sizeof(appBarData); appBarData.hWnd =
FindWindow(_T("Shell_TrayWnd"), NULL);
appBarData.uEdge = ABE_BOTTOM;
appBarData.rc.left = -2;
appBarData.rc.top = -2;
appBarData.rc.right = 1026;
appBarData.rc.bottom = 57;
SHAppBarMessage(ABM_SETPOS, &appBarData);
MoveWindow(hwnd, a,b,c,d, TRUE); //a,b,c,d are desided position and size
However, the code still doesn't work at all. Microsoft seems to prevent
people change size/position of taskbar.
How can I do that? Any help is appreciated.
Thanks,
Vince
Loading...