Click to See Complete Forum and Search --> : How to get path of an executable file?


hieu239
March 7th, 2003, 08:55 PM
I used "CreateToolhelp32Snapshot()" and "Process32Next()" to get information of a process and store it in "PROCESSENTRY32".

Question:
How can I get full path of executable file? ("szExeFile" property just store name of executable file.)
Thank you!

CBasicNet
March 7th, 2003, 09:54 PM
Hope it helps

http://www.codeguru.com/forum/showthread.php?s=&threadid=225845&highlight=application+path

The answer is using Win32 API, despite the thread title.

Andreas Masur
March 8th, 2003, 12:45 AM
Take a look at this FAQ (http://www.codeguru.com/forum/showthread.php?s=&threadid=231171)...

tomkat
March 15th, 2003, 05:12 PM
char szPath[512]="";
GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));


replace GetModuleHandle(NULL) - with the one of the running file :)

Timmmm3d
March 15th, 2003, 05:39 PM
Heh, I was just about to post exactly the same question - talk about coincidences...