• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

locating application *.exe

I need my application MyApp to be able to locate the directory where it is installed (i.e., the directory where MyApp.exe is located). How do I do this ? - obviously, without searching the entire hard drive.
0
olegsp
Asked:
olegsp
1 Solution
 
Vinayak KumbarSr Program ManagerCommented:
Hi,
U can use the following code to get Ur exe path

char ExeFileName[MAX_PATH];
DWORD pathLength;
pathLength = ::GetModuleFileName(NULL, ExeFileName, sizeof(ExeFileName));

U will get the path in  ExeFileName;

Hope it helps.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now