CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    WA
    Posts
    65

    CFileDialog changes the current directory - Help

    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

  2. #2
    Guest

    Re: CFileDialog changes the current directory - Help

    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.


  3. #3
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: CFileDialog changes the current directory - Help

    Always use full path for the files you are using

    Sally


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured