问题描述
无论我做什么。 OpenProcess保持返回null。
#include< windows.h>
#include< iostream>
#include< psapi.h>
使用命名空间std;
void loop(){
DWORD pid;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS,false,pid);
if(hProc == NULL){cout< < 无法打开进程。;
LPWSTR path = new WCHAR [MAX_PATH];
DWORD charsCarried = MAX_PATH;
}}
int main(){loop();}
我有什么尝试过:
No matter what I do. OpenProcess keeps returning null.
#include <windows.h>
#include <iostream>
#include <psapi.h>
using namespace std;
void loop(){
DWORD pid;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if (hProc == NULL){ cout << "Cannot open process.";
LPWSTR path = new WCHAR[MAX_PATH];
DWORD charsCarried = MAX_PATH;
}}
int main(){loop();}
What I have tried:
No matter what I do. OpenProcess keeps returning null.
#include <windows.h>
#include <iostream>
#include <psapi.h>
using namespace std;
void loop(){
DWORD pid;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if (hProc == NULL){ cout << "Cannot open process.";
LPWSTR path = new WCHAR[MAX_PATH];
DWORD charsCarried = MAX_PATH;
}}
int main(){loop();}
推荐答案
这篇关于Openprocess()不断失败。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!