views:

175

answers:

2

I'd like to display a little popup window next to the notification area. It's similar to what Outlook/Skype/Live! Messenger/etc does when it displays the notification about a new message. In my case it will have some input controls (textbox, datetimepicker, buttons...) so a simple bubble won't do.

The trick is doing this correctly when the user has multiple monitors and/or the taskbar is not located at the bottom of the screen. I could not find any functions that would let me determine the position and orientation of the taskbar/notification area.

+3  A: 

C# Example

bassfriend
Nice! Thanks! :)
Vilx-
Hard-codes the taskbar class name, though, which isn't a contract but an implementation detail. And what about people using another shell?
Joey
http://www.codeproject.com/KB/shell/trayposition.aspxAnother approach consinder the comment from johannes rössel, simple to port to C# imo
bassfriend
@Johannes: I haven't seen custom shells since Windows 98 went extinct. And if you're using a custom shell then there are no guarantees that there is a notification area at all, so all this becomes meaningless. But you do have a point, so I'll put a check in the code. If the window will not be found, my window will be displayed at the bottom right of the primary monitor.
Vilx-
A: 

You need to get the actual location of your notification icon, and place your pop-up window near that (or wherever you like).

You need to translate your XY locations relative to desktop(s). AFAIK, there are no direct function, even in Win32 API which can directly give you the answer.

These sites will help you-
1. http://forum.codecall.net/managed-c/262-dual-monitors-window-position.html
2. http://msdn.microsoft.com/en-us/magazine/cc188759.aspx

Nayan