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.
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.
HANDLE myProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, processInfo->th32ProcessID);
GetModuleFileName((HMODULE)myProcess, g, MAX_PATH);
MessageBox(NULL, g, "this is the file name", MB_OK);
Thanks for any help :-)
Oh btw, the problem isnt with the OpenProcess method, that works fine.