Right-click the menu on the tray and then choose another place, such as the desktop, the menu cannot be hidden, always on the tray, unless the menu can be hidden under the operation, you only need to add a sentence
::SetForegroundWindow(m_nid.hWnd);
You can solve this problem.
Void cxxxdlg: createtray () {m_nid.cbsize = (DWORD) sizeof (notifyicondata); // notifyicondata m_nid tray member variable ready = This-> m_hwnd; m_nid.uid = 128; m_nid.uflags = nif_icon | nif_message | nif_tip; listener = wm_showtask; m_nid.hicon = loadicon (callback (), makeintresource (128); shell_policyicon (nim_add, & m_nid );}
Lresult cxxxdlg: onshowtask (wparam, lparam) // tray Response Message {If (wparam! = 128) return 1; Switch (lparam) {Case wm_rbuttonup: {: setforegroundwindow (m_nid.hwnd); // click another place to hide the lppoint lpoint = new tagpoint in the tray ;:: getcursorpos (lpoint); m_menu.getsubmenu (0)-> trackpopupmenu (Bytes | tpm_leftbutton | tpm_rightbutton, lpoint-> X, lpoint-> Y, this); Delete lpoint; break ;} case wm_lbuttondblclk: {This-> showwindow (sw_show); setforegroundwindow () ;}break ;}return 0 ;}