Thread: Taskbar stupidity

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    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?)

  2. #2
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    you can pass FindWindow "Shell_TrayWnd" to get a handle of the taskbar.

    Code:
    HWND hwndTskBar = FindWindow("Shell_TrayWnd", NULL);

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Try using NULL for the taskbar handle.

  4. #4
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    @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...
    Last edited by @nthony; 07-30-2007 at 07:33 PM.

  5. #5
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    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.

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting all window handles on taskbar
    By Yuri in forum Windows Programming
    Replies: 1
    Last Post: 06-17-2006, 04:31 PM
  2. Replies: 0
    Last Post: 11-08-2005, 02:28 AM
  3. Problem with an icon in the TaskBar status area
    By dit6a9 in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2004, 10:33 PM
  4. Change/update Startmenue, Taskbar, Systemtray
    By y0011482 in forum Windows Programming
    Replies: 1
    Last Post: 07-26-2004, 04:22 AM
  5. How do I show the taskbar without activating it?
    By avn in forum Windows Programming
    Replies: 1
    Last Post: 02-22-2003, 09:21 PM