2

This is for interest only, as I can't find the answer.

Following on from reading Any known problems with getting SaveFileDialog's InitialDirectory property working in Windows 7? I looked for anywhere that OpenFileDialog would be saving the information. I found that it even survives a hard reboot, but a search through the registry fails to find any reference to the saved directory.

It's not in the Environment.CurrentDirectory either.

I'd have put this in as a comment to the above, but don't have enough reputation.

Peter
  • 151
  • 6
  • Possible duplicate of [How does WPF OpenFileDialog track directory of last opened file?](https://stackoverflow.com/questions/11144770/how-does-wpf-openfiledialog-track-directory-of-last-opened-file) – ardila Feb 01 '19 at 19:04
  • Yes I think you're right. Thanks. My search didn't find that one. – Peter Feb 01 '19 at 19:20
  • No worries. Your question piqued my interest, so I went on the hunt for an answer :) Cheers – ardila Feb 01 '19 at 19:21
  • What's interesting is that this seems to be file-type specific, but nothing else. It you have 2 programs, both of which use the same file type, it seems that looking up a file in one program changes the other's default. (I've not tested this - yet). Which seems rather inadvisable design. – Peter Feb 01 '19 at 19:31
  • According to [this](https://learn.microsoft.com/en-us/windows/win32/shell/common-file-dialog#state-persistence), it also depends on the process. And on an optional GUID that the application can set with [SetClientGuid](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setclientguid). A fix to enable multiple use cases for these dialogs within one application. I think calling that *inadvisable design* is an understatement - preserving the state should have been the application's job to begin with. – dialer Apr 19 '20 at 15:59
  • @dialer It's over a year since I asked the question, and I now can't remember the context, and have lost interest! That link is useful, but it implies that the persistence can be controlled within a single application. The wording of my previous comment implies that it's persistent across applications. Your last sentence seems to imply that an application should preserve its state. Agreed, but how is it to know that the state was changed by another application? – Peter Apr 20 '20 at 08:57

0 Answers0