确定一个应用程式是否没有响应

2008-02-23 05:36:18来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

今天在MSN的核心讨论组上看到两篇文章.讨论的乃是应用程式是否没有响应.原文如下:

> How is it possible to determine a process is "not responding" like NT Task
> Manager do?
The heuristic works only for GUI processes, and consists of calling
SendMessageTimeOut() with SMTO_ABORTIFHUNG.

>There is any API call to do the job, or this status is simply a deduction
>based on process counters, like that returned from call to GetProcessTimes
>API function?

Use SendMessageTimeout with a value of WM_NULL. That's all Task
Manager does to determine this AFAIK.

--
有理有理.当然,我这里更有一个UNDOCUMENTED函数,乃是其他的解决方案,NT和9X有个USER32.DLL的函数,IsHungAppWindow(NT)和IsHungThread(9X).使用起来简便无比.下面给出原型.
BOOL IsHungAppWindow (
HWND hWnd, // handle to main app's window
);

BOOL IsHungThread (
DWORD dwThreadId, // The thread's identifier of the main app's window
);
有了原型,连解释都无需,好得不的了.:)但是调用时需要GetProcAddress.库里没有该函数.




标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: Perform()和SendMessage()的不同

下一篇: 怎样用代码来最小化或恢复程式

热门词条
热门标签