ON_EN_KILLFOCUS 被调用多次
我正在使用 CEdit 控件。我已经为 ON_EN_KILLFOCUS 消息分配了一个事件处理程序。它被正确调用。但问题是,每当我关闭对话框时,该事件处理程序就会被调用四次。我怎样才能防止这种情况发生?
I am using a CEdit control. And I have assigned an event handler for ON_EN_KILLFOCUS message. It gets called correctly. But the problem is that, when ever, I close the dialog box, this event handler gets called four times. How can I prevent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么要试图阻止它?只要确保你的处理程序忽略那些不重要的 -
Why try to prevent it? Just make sure your handler ignores the ones that don't matter -
刚刚遇到类似的问题并通过分离到不同的处理程序来解决。
我正在使用:
OnKillFocusOnEdit
每次这两个编辑中的任何一个失去焦点时都会收到两条消息。现在,通过更改为以下内容,每个函数仅按预期接收一条消息:
Just ran into similar issue and solved by separating to different handlers.
I was using:
OnKillFocusOnEdit
will receive two messages every time either of these two edits lose focus.Now by changing to following, each function receives only one message as expected: