SetForegroundWindow(hDlg);After fixing this, be careful that your menu is attached to the WM_RBUTTONUP message and not the WM_RBUTTONDOWN message. Using the latter will cause occasional double popup menus where the Windows taskbar menu will overlap your program's menu (see the next post).
TrackPopupMenu(hSubMenu, TPM_RIGHTBUTTON, pt.x, pt.y,
0, hDlg, NULL);
PostMessage(hDlg, WM_NULL, 0, 0);
Sunday, March 23, 2008
How do I make popup menus for notification (system tray) icons disappear after clicking elsewhere?
This is a common problem with notification icon menus. When you right click on a notification icon, a popup menu appears. When you click somewhere else, such as on the desktop, the menu remains. This can be really frustrating. Microsoft has a knowledge base article on this: MS KB Q135788. The solution is to surround TrackPopupMenu with calls to SetForegoundWindow and SendMessage.
Subscribe to:
Post Comments (Atom)
1 comment:
Whatever you do in life, surround yourself with smart people who'll argue with you. See the link below for more info.
#surround
www.ufgop.org
Post a Comment