Click to See Complete Forum and Search --> : CFileDialog changes the current directory - Help


Troy T
May 23rd, 1999, 09:05 PM
Hello-

I am having a problem that goes like this: I have a dialog based application, and writes .txt files occasionally for user preferences, data files, etc.. But to acquire some of that data I use the CFileDialog for browsing to a file. Well every time that I browse to a file, the save fails because the directory structure isn't the same. It's as if it's changing the current directory that my thread is pointing to.

Can anyone suggest a fix for this? I've tried writing the directory to the .INI file at Install time, and then doing a SetCurrentDirectory (win32 function) with the information from the .INI file, but that doesn't always work either.

Thanks in advance for any help you can provide.

- Troy

May 24th, 1999, 08:33 AM
Before displaying the CFileDialog, get the current directory by calling ::GetCurrentDirectory. Then after the CFileDialog is dismissed, reset the current directory back by calling ::SetCurrentDirectory.

sally
May 24th, 1999, 08:45 AM
Always use full path for the files you are using

Sally

Sally
May 24th, 1999, 08:45 AM
Always use full path for the files you are using

Sally