Process Module Name
-
How can I get the file name of a module having an HWND or ProcessID. I need it in an Win95 application. I can not use GetWindowsModuleFileName() because is not compatible on Win95. Please help !
Here's something that may help: Use CreateToolhelp32Snapshot to get a (handle) to a snapshot of the processes etc., then traverse the processes using Process32First and Process32Next (using the handle returned by CreateToolhelp32Snapshot and a PROCESSENTRY32 structure). The PROCESSENTRY32 structure has a member called: szExeFile which will contain the path and filename of the executable file for the process. In your case, if you have a ProcessID, you could compare it to the th32ProcessID member of the PROCESSENTRY32 structure (or th32ParentProcessID) to isolate the process you are after, and then use the szExeFile member. See 'Tool Help Library' in MSDN library, and go to Using the Tool Help Functions --> Taking a Snapshot and Viewing Processes It appears that THL is Win 95/98/NT/2000 compliant. Hope that helps. ================== The original message was: How can I get the file name of a module having an HWND or ProcessID. I need it in an Win95 application.
I can not use GetWindowsModuleFileName() because is not compatible on Win95.Please help !