让托盘弹出菜单失去焦点时自动消失

from:http://www.slyar.com/blog/tray-menu-exit.html

转自: http://www.slyar.com/blog/tray-menu-exit.html


托盘弹出控制菜单后,单击其他地方或者按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()前面,这样就使得当前窗口变为前置了。

STATUS:This behavior is by design. //TNND,居然告诉我设计就是这样的,设计个锤子...


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值