如何在MFC中创建非交互式窗口
在我的应用程序中,我有一个弹出的窗口,上面有小消息(类似于工具提示)。 该窗口使用分层属性来绘制 alpha 背景等。
如果我同时打开其中几个窗口,然后用鼠标单击其中一个,当它们消失时,它们会导致我的应用程序失去焦点(它将焦点切换到窗口后面的应用程序)当前的一个)。
如何停止窗口中的任何交互?
In my application I have a window which I popup with small messages on it (think similar to tooltip). This window uses the layered attributes to draw alpha backgrounds etc.
If I have several of these windows open at once, and I click one with my mouse, when they disappear they cause my application to lose focus (it switches focus to the app behind the current one).
How do I stop any interaction in my window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在尝试了
WM_NCACTIVATE
消息但没有成功后,我覆盖了WM_SETFOCUS
消息:这似乎可以解决问题。 不知道为什么它会起作用! 欢迎对此问题发表评论。
After playing with the
WM_NCACTIVATE
message with no luck, I overrode theWM_SETFOCUS
message:That seems to do the trick. No idea why it works though! Comments welcome on that issue.
它之所以有效,是因为 OnSetFocus(与许多 On* 方法一样)使您有机会在操作实际发生之前抢占该操作。 焦点实际上从未切换到非交互式窗口。
It works because OnSetFocus (like many of the On* methods) gives you a chance to pre-empt an action before it actually occurs. The focus never actually switches to your non-interactive window.