|
<火山程序 类型 = "通常" 版本 = 1 />
方法 检测自身是否无响应 <类型 = 逻辑型 注释 = "检测自身程序是否无响应" 返回值注释 = "返回假 有响应 返回真 无响应" @禁止流程检查 = 真>
{
@ int id = GetCurrentProcessId();
@ HANDLE hProcess = ::OpenProcess (PROCESS_ALL_ACCESS,NULL,id);
// @ ::CloseHandle(hProcess);
@ FILETIME createTime, exitTime, kernelTime, userTime;
@ if (GetProcessTimes(hProcess, &createTime, &exitTime, &kernelTime, &userTime) == 0)
@ {
@ return false;
@ }
@ ::CloseHandle(hProcess);
@ ULARGE_INTEGER processTime;
@ processTime.LowPart = userTime.dwLowDateTime;
@ processTime.HighPart = userTime.dwHighDateTime;
@ ULARGE_INTEGER currentTime;
@ GetSystemTimeAsFileTime(reinterpret_cast<LPFILETIME>(¤tTime));
@ ULONGLONG elapsedTime = currentTime.QuadPart - processTime.QuadPart;
@ elapsedTime /= 10000;
//@ if
//@ {
@ return (elapsedTime >= 3000);
//@ }
//@ return false;
}
|
|