|
-
Jan 28th, 2003, 08:50 PM
#1
Thread Starter
Frenzied Member
C++ App.path
OK i learned how to get the app.path in vb and the the whole file path and name from c++ consol but i can i get it from Win32 c++
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Jan 28th, 2003, 09:52 PM
#2
Hyperactive Member
GetCurrentDirectory() should take care of it.
Then you can manage the directory with PathCombine().
-
Jan 28th, 2003, 10:13 PM
#3
Frenzied Member
Originally posted by made_of_asp
GetCurrentDirectory() should take care of it.
Then you can manage the directory with PathCombine().
You cant guarentee that the current directory is the same as the application path. I believe that MSVC will change the current directory to the one the executable resides in when in Debug/Run mode, however, in the real world, dont bet on it.
Use GetModuleFilename(), and trim it backwards until you hit a '\\' character.
Z.
-
Jan 28th, 2003, 10:26 PM
#4
Thread Starter
Frenzied Member
thanks alot . i would have thought it would have been complicate dbut you made it simple lol thanks again
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Jan 28th, 2003, 10:30 PM
#5
Hyperactive Member
TRUE. Current Directory can change, but I always use it anyway. You would have to modify your shortucts ""Working Directory" function.
Code:
#include <shlwapi.h>
void Mod()
{
CHAR szModule[2048];
GetModuleFileName(GetModuleHandle(NULL), szModule, 2048);
::PathRemoveFileSpec(szModule);
MessageBox(NULL, szModule, "AAA", MB_OK);
}
Last edited by made_of_asp; Jan 28th, 2003 at 10:37 PM.
-
Jan 30th, 2003, 08:36 AM
#6
MSVC++ sets the working directory in debug runs to the project main directory, which is not where the exe resides in.
Unlike VC# btw...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 30th, 2003, 12:03 PM
#7
Frenzied Member
Originally posted by CornedBee
MSVC++ sets the working directory in debug runs to the project main directory, which is not where the exe resides in.
Unlike VC# btw...
It is in my projects 
Z.
-
Jan 30th, 2003, 01:10 PM
#8
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|