|
-
Jun 28th, 2001, 03:43 PM
#1
Thread Starter
Hyperactive Member
Sys Tray..
Code:
case WM_SHELLNOTIFY:
{
if(lParam == WM_RBUTTONDOWN) //right-click the icon
{
POINT pt;
GetCursorPos(&pt);
TrackPopupMenu(hPopupMenu1,TPM_RIGHTALIGN,pt.x,pt.y,NULL,
hwnd,NULL);
}
//left-click or double-click the icon
else if((lParam == WM_LBUTTONDOWN) || (lParam == WM_LBUTTONDBLCLK))
{
POINT pt;
GetCursorPos(&pt);
TrackPopupMenu(hPopupMenu2, TPM_RIGHTALIGN, pt.x, pt.y, NULL,
hwnd, NULL);
}
}
break;
This is what puts my window in the system tray. Everything works perfectly fine. The only thing is that when the menu is poped from the icon, if you click, for example,the desktop while it is visible and poped, it does not disappear. It just sits there, and disappears when i move back over it. How would I make it go away as soon as I click somewhere else? Thanks!
Amon Ra
Amon Ra
The Power of Learning.
-
Jun 28th, 2001, 03:50 PM
#2
Monday Morning Lunatic
Before you use TrackPopupMenu, use SetForegroundWindow on the window you associated with the icon. Bizarre, but it works.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 28th, 2001, 03:56 PM
#3
Thread Starter
Hyperactive Member
Would that be the main window(hwnd)?
Amon Ra
The Power of Learning.
-
Jun 28th, 2001, 03:58 PM
#4
Monday Morning Lunatic
Whichever window you supplied to the NOTIFYICONDATA struct.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 28th, 2001, 04:02 PM
#5
Thread Starter
Hyperactive Member
Amon Ra
The Power of Learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|