OpenProcess
HANDLE OpenProcess(
[in] DWORD dwDesiredAccess,
[in] BOOL bInheritHandle,
[in] DWORD dwProcessId
);인자
설명
보편적인 값
Example
#include <windows.h>
#include <tlhelp32.h>
#include <iostream>
using namespace std;
HANDLE openProcessByPid(DWORD processId) {
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
if (!hProc) {
wcout << L"Failed to get Process handle" << endl;
}
return hProc;
}
int main() {
int pid = 1234;
HANDLE hProc = openProcessByPid(pid);
CloseHandle(hProc);
return 0;
}References
Last updated