检测自身是否无响应
<火山程序 类型 = "通常" 版本 = 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;
@ }
@ 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 (elapsedTime >= 3000)
@ {
@ return true;
@ }
@ return false;
}
?程序都无响应了,怎么调用api检测? xrea 发表于 2023-12-27 23:41
?程序都无响应了,怎么调用api检测?
创建线程 <火山程序 类型 = "通常" 版本 = 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;
}
页:
[1]