WM_CANCELMODE
The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
WM_ENTERIDLE
The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages.
WM_ENTERIDLE
fuSource = wParam; // idle-source flag
hwnd = (HWND) lParam; // handle of dialog box or owner window
我们一般使用TrackPopupMenuEx弹出菜单,问题的关键是,在菜单未关闭时,TrackPopupMenuEx并不返回,并拦截鼠标和键盘消息,
使用spy可以看到,此时的工具栏收不到任何消息,当然无从改变热点
在WM_ENTERIDLE响应函数中发送此消息即可达到目的
本文探讨了WM_CANCELMODE与WM_ENTERIDLE消息的作用及应用场合,特别是当使用TrackPopupMenuEx函数时,如何确保工具栏可以接收到消息并相应地更改热点状态。

被折叠的 条评论
为什么被折叠?



