PopupMenu + ShellNotifyIcon
Posted on 1998-12-19
Now I use a TShellNotifyIcon.
procedure WndProc ( var Msg: TMessage ); override;
procedure TfrmMain.WndProc ( var Msg: TMessage );
var pos: TPoint;
case Msg.Msg of
WM_User + 1 :
case Msg.LParam of
GetCursorPos ( pos );
mnuMain.Popup ( pos.x, pos.y );
//still to do
everything's working fine, except to the fact, that when the mnuMain.Popup function is called, it doesn't take it back. I mean: when you open a popup-menu by a right-click onto an Icon in the Shell_NotificationArea and then click onto the Desktop or onto the window of another app, the popup-menu disapears. Well, my popup window does not disapear. Why ?
I did already try
ShowWindow ( Application.Handle, SW_HIDE );
at the end of my code. Still, the popup-menu stays visible.
Well, at least until you move the cursor over it again. If you clicked onto the desktop before ( lost focus ) and then move the cursor to the still visible popup-menu, then it disapears.