VC creates a tray. Right-click the tray menu and click somewhere else to hide the problem.

Source: Internet
Author: User

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 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.