Click to See Complete Forum and Search --> : Get the AppPath


diggs
May 8th, 1999, 08:00 AM
How can I get the full path name of my application at runtime???

Bob Clarke
May 8th, 1999, 11:48 AM
See GetModuleFileName() in the docs.

Lynx
May 8th, 1999, 12:04 PM
You can also use GetCommandLine() to get the full path for your app.

Otavin A.
September 11th, 1999, 07:19 AM
Hi.
I use this procedure:

UINT GetBaseDirectory(LPTSTR lpBuffer, UINT uSize)
{
if(lpBuffer==NULL) {ASSERT(0); return 0;}

DWORD resLen = GetModuleFileName(NULL, lpBuffer, uSize);
if(resLen==0) {ASSERT(0); return 0;}

//exclude file name
do
resLen--;
while(lpBuffer[resLen-1]!='\\');
lpBuffer[resLen] = 0;

return resLen;
}

Best wishes.