TTrayIcon [Solved]

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: TTrayIcon

Post by Antonio Linares »

Finally fixed! :-)

This is the required change in Class TTrayIcon:

Code: Select all

METHOD Command( nWParam, nLParam ) CLASS TTrayIcon
      ...
      case nLParam == WM_RBUTTONDOWN .and. ! Empty( ::bRClicked )
           SetForegroundWindow( ::oWnd:hWnd )
           Eval( ::bRClicked, a[ 1 ], a[ 2 ] )
      ...
 
Now FWH\samples\TestTray.prg properly closes the Popup menu clicking outside it or pressing Esc :-)

This explanation from the msdn gave us the solution:
To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise, the menu will not disappear when the user clicks outside of the menu or the window that created the menu (if it is visible).
http://msdn.microsoft.com/en-us/library ... S.85).aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply