用GetModuleHandle函数: The GetModuleHandle function retrieves a module handle for the specified module if the file has been mapped into the address space of the calling process.HMODULE GetModuleHandle( LPCTSTR lpModuleName ); HINSTANCE hInst=GetModelHandle("MyDll.dll");
HMODULE hModule, // handle to module
LPTSTR lpFilename, // path buffer
DWORD nSize // size of buffer
);
char *str = new char[256];
::GetModuleFileName(NULL,str,MAX_PATH);
//str即为所求
delete []str;
str=NULL;
The GetModuleHandle function retrieves a module handle for the specified module if the file has been mapped into the address space of the calling process.HMODULE GetModuleHandle(
LPCTSTR lpModuleName
);
HINSTANCE hInst=GetModelHandle("MyDll.dll");
如何获取某个进程的主窗口以及创建进程的程序名?