Hi all,
Im trying to use the GetModuleFileName for a running process (which has been opened with OpenProcess). The code below isnt my exact code but it does show what im trying to do.
Code:
HANDLE myProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, processInfo->th32ProcessID);
char g[MAX_PATH];
GetModuleFileName((HMODULE)myProcess, g, MAX_PATH);
MessageBox(NULL, g, "this is the file name", MB_OK);
The code just prints out junk value in the MessageBox which I assume is because Im trying to cast myProcess of type HANDLE to type HMODULE.
Thanks for any help :-)
Oh btw, the problem isnt with the OpenProcess method, that works fine.