By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

How can I interact with the new Windows 7 Taskbar (MSTaskListWClass)

P: 10

I need to determine the location (RECT) of application windows (aka "buttons") in the system taskbar.
In Windows XP, this was possible by simply obtaining the handle to the "ToolbarWindow32" window that represents the taskbar and then using SendMessage to enumerate the taskbar buttons and obtain their RECTs using toolbar "TB_..." window messages. (i.e. TB_GETBUTTON, TB_GETRECT).

But now in Windows 7, the taskbar has been replaced by a new type of window with the class "MSTaskListWClass" instead of a "ToolbarWindow32". It is trivial to obtain a handle to this window. But unfortunately it is undocumented (as far as I can tell), and the TB_ window messages do not work with it.

Does anyone know how to either send messages to the MSTaskListWClass window to obtain item info (in particular their text and RECT). OR is there an API or interface I can use to obtain this information directly?

(Note: The ITaskbarList shell interface does not provide methods (as far as I know) to enumerate the icons on the taskbar OR to obtain their text or RECT.)

If you want to know more about WHY I need this information, please read below:
I am writing an application that is a Tutorial for new Windows 7 users (or new PC/Windows users in general). Part of the tutorial demonstrates how the windows taskbar works.
A requirement for this tutorial application is to highlight (using a custom "magnifier" window I have created) certain areas of the desktop. For the segment about the taskbar, I have to "highlight" various taskbar buttons, and I have to monitor the user's mouse to see when it enters the region of a button for a specific application.
I can use the ITaskbarList interface to "flash" the button, which may be acceptable. However, there is no way for me to monitor when the users mouse hovers over the button unless I can obtain its RECT.

Thanks for any help anyone can provide!!
Aug 26 '10 #1
Share this Question
Share on Google+
6 Replies

Expert Mod 5K+
P: 9,197
MSTaskListWClass is an undocumented Windows 7 class. That means you are not supposed to fiddle with the windows on the task bar.
Aug 27 '10 #2

P: 10
@weaknessforcats - I think you misunderstood. I don't intend to "fiddle" with anything.
I.e. this is a "read-only" operation. The objective is to direct the user's attention to a particular region of the taskbar (whether it is an icon or empty space) and to detect when the user's mouse has entered that region.
The taskbar buttons will not be altered in any way.
Aug 27 '10 #3

P: 10
Also note that I am not asking only for undocumented hacks. I am also very much interested in knowing if there are documented/approved ways to get the Size and Location of taskbar buttons.

IMHO, the ITaskbarList interface is much more invasive than what I am asking for. By that I mean that it allows any developer to add, remove, flash etc, icons from ANY application on the taskbar.
To me that seems much more "disturbing" than simply being able to determine read-only information such as the Text and RECT of existing icons.
Aug 27 '10 #4

Expert Mod 5K+
P: 9,197

P: 10
Thanks for your replies and effort. I was aware of that post, but as you can see, the problem is unresolved.
Aug 27 '10 #6

P: n/a
Hi, if you use spy++, you can see that there is a child of MSTaskListWClass and it is just a toolbar, so all the messages works just as in winxp. BUT, there is an additional window containing all the hidden items, so you must find the usual tray window and the new hidden window (the one that pops up when you press the arrow button). i don't recall the exact name, but use spy++, is something like hiddentray_wherever_wherever.
Oct 25 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.