VC 高手 进来看看呀

来源:百度知道 编辑:UC知道 时间:2024/06/17 04:00:35
HWND hWndParent;
DWORD DWord;
hWndParent=FindWindow(NULL,"垃圾程序");
cout<<hWndParent;
DWord=GetWindowThreadProcessId(hWndParent,NULL);
cout<<OpenProcess(PROCESS_ALL_ACCESS,false,DWord); // 这里怎么总是0x000........?????????怎么回事?
cout<<DWord;
这样行吗,
但是还是 有错误

hWndParent=FindWindow(NULL,"垃圾程序");
cout<<hWndParent;
long a;

DWord=GetWindowThreadProcessId(a,hWndParent);

错误“GetWindowThreadProcessId' : cannot convert parameter 1 from 'long' to 'struct HWND__ *'”

这点程序看能看不出来吧。

这个是获取窗口句柄和进程的API函数,你在最后面用的是所有进程的参数,所以才会有这样的结果

DWord=GetWindowThreadProcessId((Long)hWndParent,NULL);