缺少 WM_LBUTTONDOWN
我在带有无模式对话框的屏幕上有一个非常奇怪的行为,我找不到解决方案。
我通过单击视图中的按钮来打开无模式对话框。由于对话框不是模态的,我应该能够在对话框打开时单击此视图中的任何其他按钮。但我不能。事实上,我无法将焦点放在任何控件上..编辑、按钮等。
我检查了视图正在获取哪些消息,似乎它没有获取 WM_LBUTTONDOWN 消息。但它确实收到了 WM_LBUTTONUP 消息。
更奇怪的是,这种情况只发生在 Windows 7 64 位(在 Windows XP 中没有人报告此问题,并且已经使用了很长时间)并且仅在某些计算机中发生。但我找不到原因,也不知道为什么这些计算机会发生这种情况。
有人知道吗?从哪里开始寻找?
谢谢。
哈维尔
I have a very weird behaviour in a screen with a modeless dialog and I cannot find a solution.
I open a modeless dialog by clicking on a button in a view. As the dialog is not modal I should be able to click any other buttons in this view while the dialog is opened. But I cannot. In fact I can not place the focus in any control..edits, buttons, etc.
I have check which messages the view is getting and it seems it doesn't get the WM_LBUTTONDOWN message. But it does get the WM_LBUTTONUP message.
To make things even weirder it just happen in Windows 7 64-bits (no one reported this problem in windows XP and is being used for a long time) and just in some computers. But I cannot find the reason and I don't have a clue about why it happens in these computers.
Does anybody have a clue? Somewhere to start looking at?
Thanks.
Javier
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个棘手的问题。
问题恰好出在对话框的自定义实现中。他们使用 MFC2008 视觉样式绘制它的非客户区域,并且当为视觉管理器调用 OnNcActivate 时,当 Aero 和桌面窗口管理器处于活动状态时,它返回 FALSE。因此对话框没有将控件释放给其子控件。
正如我所说,相当棘手......我只是让你知道问题出在哪里,以防万一某个地方的人遇到类似的问题。我花了两天时间试图弄清楚。
谢谢。
哈维尔
it was a tricky question.
The problem happened to be in a custom implementation of the dialogs. They draw it's non-client area with MFC2008 visual styles and when calling OnNcActivate for the visual manager it returned FALSE when Aero and Desktop Window Manager where active. So the dialog was not releasing the control to its child-controls.
Quite tricky as I said.....I just let you know where was the problem just in case someone somewhere ever have a similar problem. I lost two days trying to figure it out.
Thanks.
Javier
您必须以错误的方式处理
WM_NCACTIVATE
。确保父窗口过程在收到 wparam 为FALSE
的WM_NCACTIVATE
时返回TRUE
。you must deal with
WM_NCACTIVATE
in wrong way. make sure the parent window procedure returnTRUE
when it receiveWM_NCACTIVATE
with wparam isFALSE
.这是一个老问题,但对于来这里寻找问题解决方案的人来说:请注意 WM_MOUSEACTIVATE 消息。如果返回 MA_ACTIVATEANDEAT 或 MA_NOACTIVATEANDEAT,则随后将忽略鼠标单击。
This is and old question, but for whoever comes here looking for a solution to their problem: beware of the WM_MOUSEACTIVATE message. If either MA_ACTIVATEANDEAT or MA_NOACTIVATEANDEAT is returned, the mouse click will subsequently be ignored.