确定一个应用程序是否没有响应
今天在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.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |