|
-
May 5th, 1999, 02:30 PM
#1
Accessing an applications executable path...
I want to know how to programmatically get hold of the Path of the MFC program i have written. I can get access to the current application name, but i want the entire path of the executable.
What i want to achieve is that, when a user run my application, i want to know the entire path from where the application is being launched. Tried the variable present in the CWinApp class, but not able to get the Path. Tried looking in Win32 API, but still couldn't converge on one if present.
Any suggestions ?
Thanx
Mahanthi
[email protected]
-
May 5th, 1999, 05:16 PM
#2
Re: Accessing an applications executable path...
Try GetModuleFileName()
Regards,
Paul McKenzie
-
May 6th, 1999, 03:47 AM
#3
Re: Accessing an applications executable path...
try using the string:
_pgmptr
this will give you the application path
Hope this helps,
Steven
-
May 6th, 1999, 04:34 AM
#4
Re: Accessing an applications executable path...
Try using the following function call:
GetCurrentDirectory (sizeof (g_aEXELocation),
g_aEXELocation);
Hope this helps.
-
May 6th, 1999, 09:52 AM
#5
Re: Accessing an applications executable path...
Hi,
Thanks, it was helpful. It did work and this was the function i was looking for.
Thanks once again.
Mahanthi
[email protected]
-
May 6th, 1999, 10:34 AM
#6
Re: Accessing an applications executable path...
GetCurrentDirectory () will not give you the application exe path if you have a different Start-in directory.
You should use GetModuleFileName() as follows:
char chExePath[_MAX_PATH];
GetModuleFileName(GetModuleHandle(NULL), chExePath, _MAX_PATH);
HTH
-
May 10th, 1999, 09:19 AM
#7
Re: Accessing an applications executable path...
Guys,
Just call GetCommandLine() function
and you'll receive full path to .exe name and all parameters.
Thanks,
Ilgar Mashayev
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|