MFC让托盘弹出菜单失去焦点自动关闭
2012-09-06 14:54
1031 查看
MFC 托盘弹出控制菜单后,单击其他地方或按ESC键也都不能使托盘菜单消失(一直悬挂着怪让人难受的),必须选择托盘菜单里的控制选项才能关闭菜单(好比到一家餐厅不点菜不给走呀),这是个很严重的问题,因为如果你的菜单里面只有“关闭”按钮,那是杯具中的杯具。
不过MSDN中给出了解决办法:
135788:Menus for Notification Icons Do Not Work Correctly
SYMPTOMS:When you display a context menu for a notification icon, clicking anywhere besides the menu or the window that created the menu doesn't cause the menu to disappear.
RESOLUTION:To correct the first behavior, you need to make the current window the foreground window before calling TrackPopupMenu or TrackPopupMenuEx.
修正办法就是将SetForegroundWindow()放在pSubMenu->TrackPopupMenu()前面,这样就使得当前窗口变为前置了。
这样当弹出菜单失去焦点之后,就会自动关闭了!其实这个所谓的设计,可害苦了程序员呀!!!
不过MSDN中给出了解决办法:
135788:Menus for Notification Icons Do Not Work Correctly
SYMPTOMS:When you display a context menu for a notification icon, clicking anywhere besides the menu or the window that created the menu doesn't cause the menu to disappear.
RESOLUTION:To correct the first behavior, you need to make the current window the foreground window before calling TrackPopupMenu or TrackPopupMenuEx.
修正办法就是将SetForegroundWindow()放在pSubMenu->TrackPopupMenu()前面,这样就使得当前窗口变为前置了。
这样当弹出菜单失去焦点之后,就会自动关闭了!其实这个所谓的设计,可害苦了程序员呀!!!
相关文章推荐
- 让托盘弹出菜单失去焦点时自动消失
- MFC让系统托盘菜单失去焦点时自动消失
- 让托盘弹出菜单失去焦点时自动消失
- textField 获得焦点 弹出对话框,失去焦点关闭对话框
- popuWindow 底部弹出输入框并获取焦点,软件盘自动弹起和关闭
- 点击对象弹出DIV层菜单可以定时自动关闭
- SWT 中实现最小化到托盘图标,并只能通过托盘的弹出菜单关闭程序
- CSS+JS实现点击文字弹出定时自动关闭DIV层菜单的方法
- Android 让EditText失去焦点避免自动弹出输入法
- 当弹出的div失去焦点的时候自动隐藏
- MFC实现托盘图标及弹出菜单(Popup menu)
- Android 失去焦点,关闭弹出的软键盘
- C# TreeView树控件,失去焦点仍然高亮显示,右击节点时才弹出右键菜单,空白处右击不弹出菜单
- Android 让EditText失去焦点避免自动弹出输入法
- CSS+JS实现点击文字弹出定时自动关闭DIV层菜单的方法
- Android 中使 EditText 失去焦点,禁止弹出软键盘,及 弹出软键盘后 EditText 自动上移 不致被遮挡
- Android 让EditText失去焦点避免自动弹出输入法
- MFC为应用程序添加托盘(右键托盘,弹出菜单)
- Android 让EditText失去焦点避免自动弹出输入法
- MFC托盘加载自己的菜单和弹出菜单的部分代码