Location of app on the Windows 7 Taskbar
Is there a way to know where my application is located (in pixel) on the Windows 7 Taskbar? I am as开发者_运维问答king because I would like to show notification above the icon of my app in the Taskbar.
Thanks!
While there are a number of P/Invokes available to locate an icon in the notification area, I don't think there are any to determine the location of an icon in the taskbar.
Anyway, the notification area is still there in Windows 7, so why not use a notification icon? In fact, the Windows UX Guidelines specify this:
- Does your program need to display a notification? If so, you must use a notification area icon.
Or if you don't need a notification balloon to display textual information of a notification, you can try using an overlay icon instead.
Or flash the taskbar icon if it's critical that it has the user's attention.
There algorithm you ask for is described in detail on this blog: How to find the position of a taskbar button on Windows 7 or Vista
The way to draw the user's attention to your taskbar icon is to make it flash using the FlashWindowEx API. http://pietschsoft.com/post/2009/01/26/CSharp-Flash-Window-in-Taskbar-via-Win32-FlashWindowEx.aspx
精彩评论