-
Taskbar stupidity
This has to be the stupidist API entry I've ever seen:
ABM_GETTASKBARPOS
I am using ABM_GETTASKBARPOS because I need the position of the Windows Taskbar, yet the message specifies that I first need the HANDLE to the taskbar, how mind-boggling is that? If I had the handle in the first place, then I wouldn't be using a message titled "GETTASKBARPOS" (I would just use some other generic "get window position" variant on the handle).
Can anyone explain this please? (or is it just a typo?)
-
you can pass FindWindow "Shell_TrayWnd" to get a handle of the taskbar.
Code:
HWND hwndTskBar = FindWindow("Shell_TrayWnd", NULL);
-
Try using NULL for the taskbar handle.
-
@sleak, thanks, but I am aware of this method as I've used it before, and it is very "hackish" (i.e. I'm sure Windows will decide to change the name of the window in the future and it will stop working), so I had got my hopes up when I saw this message. Since it didn't work, I ended up using this method anyways.
@anon, I tried using NULL and the return value of GetDesktopWindow(), neither worked. Given the title of the message, I was thinking the same thing that "NULL" should suffice since they should already know internally what the handle is to their tray window, but alas, I guess thats winapi for you...
-
I don't think they've changed it in Vista. I've wrote some rather "hackish" code that uses it, and I didn't intend on it to work in Vista, but was surprised when a friend tested it and it worked just fine.
Even if MS does decide to change it, you could always use Spy++ to find it again.