Results 1 to 5 of 5

Thread: Sys Tray..

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Post 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.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    Would that be the main window(hwnd)?
    Amon Ra
    The Power of Learning.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  5. #5

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    ok, thanks
    Amon Ra
    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
  •  



Click Here to Expand Forum to Full Width