标签:find ESS max return handle highlight word ring 进程
DWORD FindProcess(TCHAR *strProcessName) { DWORD aProcesses[1024], cbNeeded, cbMNeeded; HMODULE hMods[1024]; HANDLE hProcess; TCHAR szProcessName[MAX_PATH]; if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) return 0; for (int i = 0; i < (int)(cbNeeded / sizeof(DWORD)); i++) { hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i]); EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbMNeeded); GetModuleFileNameEx(hProcess, hMods[0], szProcessName, sizeof(szProcessName)); CString strPrcFullName(szProcessName); CString strPrcName(strProcessName); if (_tcsstr(strPrcFullName, strPrcName) || _tcsstr(strPrcFullName, strPrcName.MakeLower())) { CString strNameFull; strNameFull.Format(_T("Process full name:\n%s;"), szProcessName); //AfxMessageBox(strNameFull); return(aProcesses[i]); } } return 0; }
标签:find ESS max return handle highlight word ring 进程
原文地址:https://www.cnblogs.com/hshy/p/10720983.html