-
July 23rd, 2007, 04:16 AM
#1
How to get folder path, where *.exe is running? (win32)
In other words, I have some exe file, and when user executes program, it must read the folder where it is currently located so I can know where to set global variable path.
Some might say that this can be easy by setting global environment path of windows, but however this is not the case (probably couse it's win32), and that works perfectly when developing, but in release run-time this fails.
Wherever path is set windows, cant see my conf files, so i need to know exact working dir.
Thanks.
You just divided by zero, didn't you?
-
July 23rd, 2007, 04:36 AM
#2
Re: How to get folder path, where *.exe is running? (win32)
Take a look at GetModuleFileName.Pass NULL as hModule parameter.
- Guido
-
July 23rd, 2007, 04:39 AM
#3
Re: How to get folder path, where *.exe is running? (win32)
the function GetCurrentDirectory may do the trick
-
July 23rd, 2007, 05:07 AM
#4
Re: How to get folder path, where *.exe is running? (win32)
Originally Posted by innovaltec
the function GetCurrentDirectory may do the trick
Somtimes not ! Some applications change their working directory.
Regards,
Ramkrishna Pawar
-
July 23rd, 2007, 05:56 AM
#5
Re: How to get folder path, where *.exe is running? (win32)
thanks, GetCurrentDirectory worked like a charm
I knew that there is some func. that does this, but I just could rember.
Thanks.
You just divided by zero, didn't you?
-
July 23rd, 2007, 07:08 AM
#6
Re: How to get folder path, where *.exe is running? (win32)
I would use GetModuleFileName like GNiewerth suggested.
GetCurrentDirectory does not always return the folder which contains the EXE.
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
|