<火山程序 类型 = "通常" 版本 = 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; } |
xrea 发表于 2023-12-27 23:41 创建线程 |
?程序都无响应了,怎么调用api检测? |
|Archiver|手机版|小黑屋|递归火山软件开发平台 ( 鄂ICP备18029190号 )
GMT+8, 2024-11-24 01:34 , Processed in 0.088640 second(s), 22 queries .
Powered by Discuz! X3.4
© 2001-2017 Comsenz Inc.