locked
NIN_BALLOONUSERCLICK and right mouse click RRS feed

  • Question


  • I have a system tray icon and it has a few different tray balloons that can pop up.

    In my listener for the mouse clicks I need to know if the right mouse is clicked. 
    The problem is that the NIN_BALLOONUSERCLICK gets fired before the WM_RBUTTONDOWN.
    I don't want the right click to kill the balloon, I only want it to popup the context menu.  Is there a way to do this?
    It seems like the balloon is overtop the icon when it's launced through Shell_NotifyIcon(...), so it gets the click before the Icon does.  At the least is there a way to tell that the right click was pressed?

    WndMainProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    
       if ( msg == WM_TRAYNOTIFY )
       {
    	if (lParam == WM_RBUTTONUP) {
    		//launches a popup menu
    	} 
    	else if (lParam == WM_LBUTTONDBLCLK) {
    		//shows a results screen
    	}
    	else if ( lParam == WM_RBUTTONDOWN ) {
    		//does nothing yet
    	}
    	else if ( lParam == NIN_BALLOONUSERCLICK ) {
    		//kills the balloon and launches a results screen
    	}
    
    }
    Thanks in advance for the help
    Wednesday, September 9, 2009 3:18 PM

Answers

All replies

  • Surely there's no way to fix this, Shell_NotifyIcon doesn't have any knobs to tweak this behavior.  Design your UI accordingly.

    Hans Passant.
    • Proposed as answer by jp2code Wednesday, July 18, 2012 4:03 PM
    Wednesday, September 9, 2009 8:18 PM

  • is there a way in the else if( lParam == NIN_BALLOONUSERCLICK )  to check if the right mouse button is down or clicked?

    Thanks.
    Thursday, September 10, 2009 3:49 PM
  • Hello Scott,

    Thanks for your post.

    I am afraid that there is no way to detect if the right button of mouse is pressed in NIN_BALLOONUSERCLICK, you might try to design your UI like the following sample application.

    http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc188923.aspx

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, September 15, 2009 10:08 AM
  • Hello Scott,

    I am writing to check the status of the issue on your side. Would you mind letting me know the result of the suggestions? If you have any additional question, welcome to post here.

    Have a great day!

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, September 23, 2009 9:02 AM
  • HI Rong-Chun Zhang

    Could you please update the link for the sample aplication?

    This is marked as answer and I´m very interested in the solution, because I´m facing the same issue. But the page of the link is no longer available.

    Thank you in advance.

    Sunday, June 19, 2016 3:42 PM