我可以阻止 IVideoWindow::put_Visible 发布消息吗?
当调用 IVideoWindow::put_Visible() 时,它会从消息队列中查看消息并调度它。这完全打乱了调用顺序。
我已经根据具体情况修复了几次由此导致的崩溃。也就是说,在调用 put_Visible() 之前设置一个标志,然后清除该标志。在事件处理程序中,首先检查标志,如果设置了该标志,则将事件放回消息队列并退出事件处理程序(即推迟处理直到 put_Visible() 返回。问题是我的代码库太大 有没有
办法简单地改变 put_Visible() 的行为以使其不会扰乱消息队列和调度?
When ever IVideoWindow::put_Visible() is invoked, it peek a message from the message queue and dispatch it. That totally messes up the call sequence.
I have fixed several crashes caused by this, in a case by case bias. That is, to set a flag before invoking put_Visible() and then clean the flag. And in an event-handler, check the flag first, if it is set, put the event back to message queue and exit the event-handler (i.e. postpone the handling until put_Visible() returns. The problem is my code base is too large and that method does not sustain.
Is there a way simply change the behavior of put_Visible() to make it don't mess the message queue and dispatching?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最终我有了一个想法,但没有验证。那就是在第二个新线程中调用 put_Visible() 。因为 Win32 具有独立的线程和独立的消息队列,所以 put_Visible() 不太可能弄乱主消息队列。
Eventually I get an idea but not verified it. That's to invoke put_Visible() in a second new thread. Because Win32 have separated threads have separated message queues, the put_Visible() will unlikely to mess the main message queue.