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

时间:2010-04-28 16:00:30  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:nsists 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 t...
  正文:今天在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.库里没有该函数.

确定一个应用程序是否没有响应》由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Language/VC/2010-04-28/13807.html


关键字:

关于《确定一个应用程序是否没有响应》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td