You may have noticed that the notification area applications in Windows 7 (Volume/Power/Network/Action Centre) appear centred above their icon. I wanted Keiki to do the same; the current version is hardcoded to sit in the bottom right of the screen, which causes a few problems:
- The taskbar position is not taken into account; the window will be in the bottom right even if the taskbar is at the top of the screen.
- The window appears on top of the new Windows 7 fly-out interface for hiding notify icons if the Keiki icon is kept there.
In this post, I will demonstrate how to retrieve the location of a System.Windows.Forms.NotifyIcon with a function new to shell32.dll in Windows 7: Shell_NotifyIconGetRect. Windows Vista unfortunately lacks this function: I will cover the approach I use in Vista in a later post.
Thanks to Frédéric Hamidi for pointing me in the right direction.