system tray help

This is a discussion on system tray help within the Windows Programming forums, part of the Platform Specific Boards category; Code: case WM_TRAYNOTIFY: { switch(lParam) { case WM_LBUTTONDOWN: { ShowWindow(hwnd,SW_RESTORE); }break; case WM_RBUTTONDOWN: { GetCursorPos(&pt); TrackPopupMenu(hPopupMenu, TPM_RIGHTALIGN, pt.x, pt.y, 0, ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    254

    system tray help

    Code:
    case WM_TRAYNOTIFY:
    		{						
    			switch(lParam)				
    			{				
    			case WM_LBUTTONDOWN:				
    				{
    					ShowWindow(hwnd,SW_RESTORE);						
    				}break;
    
    			case WM_RBUTTONDOWN:
    				{
    					GetCursorPos(&pt);
    					TrackPopupMenu(hPopupMenu, TPM_RIGHTALIGN, pt.x, pt.y, 0, hwnd, NULL);
    				case IDMI_RESTORE:
    					{
    						MessageBox(0, "1", "1", MB_ICONSTOP | MB_OK);
    						ShowWindow(hwnd,SW_RESTORE);
    					}break;
    				case IDMI_CLOSE:
    					{
    						MessageBox(0, "2", "2", MB_ICONSTOP | MB_OK);
    						PostQuitMessage(0);
    					}break;						
    				}break;
    			}
    			
    		}
    the problem is that no matter what option i pick on my menu i always get 1 im sure its most likely a problem with my program flow...
    i know i need another switch for the nested cases but what am i supossed to use as the switch?
    Last edited by ZerOrDie; 03-07-2003 at 10:44 PM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,659
    Yes, you need another "switch() {}" to go with those cases.
    IDMI_RESTORE isn't even in MSDN - so your on your own there.
    Make sure you know what this is doing.

    gg

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    254
    err lol i feel like and idiot dammit :P
    that should have been under the WM_COMMAND case


  4. #4
    NoOneHere
    Guest

    Question

    Whats ub with ur breaks??
    wouldnt a break be better placed inside the {}

    Code:
    //ur code
    case Yada_Yada
    {
          Blada Blada Blada
    }break;
    
    //should be:
    case Yada_Yada
    {
          Blada Blada Blada
          break;
    }

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Really? I thought it should be:
    Code:
    case Yada_Yada:
         Blada Blada Blada
         break;
    Oh well, probably just another way of doing it.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    254
    Originally posted by NoOneHere
    Whats ub with ur breaks??
    wouldnt a break be better placed inside the {}

    Code:
    //ur code
    case Yada_Yada
    {
          Blada Blada Blada
    }break;
    
    //should be:
    case Yada_Yada
    {
          Blada Blada Blada
          break;
    }
    i like putting them there... not to mention i have seen many a w32 programmer place them in this fashion...

    not to mention it does not matter if they are inside or outside...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. Replies: 3
    Last Post: 06-13-2005, 07:28 AM
  3. Why Can't C++ Be Used to Develop Operating System?
    By Antigloss in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2005, 06:16 AM
  4. System Tray = Notification Area
    By JasonD in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-12-2003, 12:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21