Get exe running location
-
There must be some nice simple function i can use to get the full directory location of where i am running my program from. Lets say my program is "me.exe" from "C:\WINDOWS\stuff\me.exe", then i want to get "C:\WINDOWS\stuff" or "C:\WINDOWS\stuff\" . My search failed so thats why im asking here, thanks :D edit: im in visual studio with a MFC dialog based application edit2: maybe i should add i want to find the full directory from the program itself, so it knows where its running from...
//Johannes
-
There must be some nice simple function i can use to get the full directory location of where i am running my program from. Lets say my program is "me.exe" from "C:\WINDOWS\stuff\me.exe", then i want to get "C:\WINDOWS\stuff" or "C:\WINDOWS\stuff\" . My search failed so thats why im asking here, thanks :D edit: im in visual studio with a MFC dialog based application edit2: maybe i should add i want to find the full directory from the program itself, so it knows where its running from...
//Johannes
Do you need to
GetModuleFileNameEx
?
WhiteSky
-
Do you need to
GetModuleFileNameEx
?
WhiteSky
-
Is there something less hightech and more simple? Like none of the DWORD and all the other stuff (i edited my question abit)
//Johannes
If you want to find path of your program see
GetModuleFileName
and for get path of other process and also an example see Enumerating All Modules For a Process[^]
WhiteSky
-
If you want to find path of your program see
GetModuleFileName
and for get path of other process and also an example see Enumerating All Modules For a Process[^]
WhiteSky
-
Im using the code: TCHAR szPath[MAX_PATH]; GetModuleFileName(NULL,szPath,MAX_PATH); AfxMessageBox(szPath); however the messagebox show the full path and the executable name, i just want the full dir, thanks :)
//Johannes
-
Is there something less hightech and more simple? Like none of the DWORD and all the other stuff (i edited my question abit)
//Johannes
Are you kidding? C++ too technical for ya? There's always VB...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
if i use that in combination with PathRemoveFileSpec(szPath); it works :D thanks WhiteSky!
//Johannes
I glad your problem solved.:-D
WhiteSky