|
-
Feb 14th, 2003, 03:43 AM
#1
Thread Starter
Addicted Member
CFileDialog changes the current directory..argh!
I present a standard open dialog to the user. Once the user makes a file selection, the file is manipulated.
Later in the code, having NOTHING to do with the file\path that was retrieved from the dialog, I must create a "error.log" file where the application resides. Little did I know, but the path changed!!!
Example:
1) Program executed, current path = C:\Temp
2) Dialog selection made, current path CHANGED to F:\Directory
3) Call Open("error.log", mode::Create..etc). File created in F:\Directory\error.log
What can I do to prevent this? I tried calling the ::GetCurrentDirectory() in the dialog's constructor, but received a ASSERT. Also calling from OnInitDialog() fails.
Any suggestions?
Thanks
Phil
-
Feb 14th, 2003, 06:53 AM
#2
There's a flag, OFN_DONTCHANGEDIR or something like that, which prevents the common dialog from changing the working directory.
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.
-
Feb 14th, 2003, 01:33 PM
#3
Thread Starter
Addicted Member
-
Feb 14th, 2003, 04:30 PM
#4
Thread Starter
Addicted Member
Well, how can I prevent this:
A shortcut to the application is placed on the desktop. When the user executes the program from the shortcut, the initial current directory becomes the desktop and thus the error.log file is generated on the desktop.
Could I prevent this?
Phil
-
Feb 14th, 2003, 05:39 PM
#5
Specifiy the working directory in the shortcut property to be something else.
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
|