当前位置:天才代写 > tutorial > C语言/C++ 教程 > 确定一个应用措施是否没有响应

确定一个应用措施是否没有响应

2017-11-06 08:00 星期一 所属: C语言/C++ 教程 浏览:659

本日在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.库里没有该函数.

 

    关键字:

天才代写-代写联系方式