WaitForSingleObject(句柄)阻止其所有者的绘制(VC ++) [英] WaitForSingleObject(handle) blocks painting of its owner (VC++)

查看:80
本文介绍了WaitForSingleObject(句柄)阻止其所有者的绘制(VC ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用WaitForSingleObject(句柄)阻止执行。

My app uses WaitForSingleObject(handle) to block execution.

句柄由ShellExecuteEx()创建,用于打开记事本上的txt文件。

The handle is created by ShellExecuteEx() for opening a txt file on notepad.

但是,当我使用鼠标移动记事本时, 我的基于对话框的应用程序(等待句柄的所有者)不会被重新绘制或更新 - 应用程序的所有背景都变为灰色(面部颜色) - 非常难看。

But, when I use mouse to move notepad,  my dialog based app (owner of the waiting handle) is not re-painted or updated - the app's all background becomes gray (face color) - very ugly.

此问题是否正常或可以要解决?

Is this problem normal or can be solved?

如果是,怎么做?

BTW:子对话框也会阻止执行,但不会阻止重新绘制。

BTW: sub-dialog also blocks execution but doesn't block re-painting.

hello me

推荐答案


我的应用程序使用WaitForSingleObject(句柄)阻止执行。

但是,当我使用鼠标时移动记事本,我的基于对话框的应用程序(等待句柄的所有者)不会重新绘制或更新

My app uses WaitForSingleObject(handle) to block execution.
But, when I use mouse to move notepad,  my dialog based app (owner of the waiting handle) is not re-painted or updated

大概是因为你的主(UI)线程是卡在WaitForSingleObject上。

Presumably because your main (UI) thread is stuck on WaitForSingleObject.


如果是,怎么做?

If yes, how?

你可以做在工作线程中等待,或使用MsgWaitForMultipleObjects(Ex)并继续处理消息。

You could do the waiting in a worker thread, or use MsgWaitForMultipleObjects(Ex) and keep processing messages.

D ave


这篇关于WaitForSingleObject(句柄)阻止其所有者的绘制(VC ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆