When a tray icon is clicked, the specified callback message is sent to the specified window. But, how can I find out where to display a shortcut menu? Ie, how can I correctly position a context menu next to the system tray?
When a tray icon is clicked, the specified callback message is sent to the specified window. But, how can I find out where to display a shortcut menu? Ie, how can I correctly position a context menu next to the system tray?
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
I'm using this:
POINT p;
GetCursorPos(&p);
Cool thanks.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
Another problem: When I display the menu, but I click somewhere else on the screen, the menu stays there, and I can't do anything, effectively the computer is useless, until I either go back to the program or click the menu. How can I remove this behavior?
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
After the call to GetCursorPos() call SetForegroundWindow() with your main window handle, then call TrackPopupMenuEx().
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
Works like a charm, thanks.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
you schould bring your program's window to front, when showing the menu (even if it's not shown):
SetForegroundWindow(hWnd);
edit: too slow ^^
And one more: How can I make the bottom right corner of the menu where the cursor is? Every other context menu is like that, but mine has the cursor at the top left.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
http://msdn.microsoft.com/library/de...opupmenuex.asp
its one of the flags