#include <windows.h>
#include <iostream>
using namespace std;
void main()
{
LPCTSTR lp;
lp = "C:\\Program Files\\Winamp\\Winamp.exe";
HMODULE hm;
hm=GetModuleHandle(lp);
if(hm==NULL)
{
cout<<"Error!"<<endl;
}
cout<<lp1<<endl;
}我的winamp是运行着的,但是这个hm老是返回NULL,这是为什么了,请指教!
#include <iostream>
using namespace std;
void main()
{
LPCTSTR lp;
lp = "C:\\Program Files\\Winamp\\Winamp.exe";
HMODULE hm;
hm=GetModuleHandle(lp);
if(hm==NULL)
{
cout<<"Error!"<<endl;
}
cout<<lp1<<endl;
}我的winamp是运行着的,但是这个hm老是返回NULL,这是为什么了,请指教!
看你的意思好像是要获得已打开进程的句柄吧?有很多方法可以实现,比如枚举进程、PSAPI等。