Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

path to my program

Status
Not open for further replies.

thiefmaster

Programmer
Jan 27, 2001
22
0
0
US
I'm trying to figure out how i can find the path to my program that I'm running. eg. if the program is in c:\myprog.exe, then the variable would be "c:\myprog.exe"

I know how to do this in C++ with argc and argv. then, all I need to do is take the value from argv[0]. However, my program is using WINAPI and i'm pretty sure it's not the same thing. I thought that maybe the path was stored in the cmdLine variable when the program starts, but that's everything but the argv[0] from C++...

Any help?

Thanks
 
Try this:

_TCHAR szFilePath[_MAX_PATH];
GetModuleFileName(NULL, szFilePath, _MAX_PATH);

Shyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top