.net windows api: get or install the latest directory used by the file open dialog

Is there a way to set or get the source directory used in the vista file open dialog box without setting the InitialDirectory property in the file open dialog box?

I want my WPF (at startup) to set the default folder once for all Open / Save dialogs. If you notice in Vista while the machine is running, it continues to default / track the last selected user directory from any file that opens / saves as dialogs. Notepad or any programs act in this way.

The reason I'm trying to do this is because I don't want to track it in my application, setting up and saving the folder. I just wanted to set a default and let vista track it after that.

Directory.SetCurrentDirectory does not.

+3
source share
2 answers

You eliminate what you need to do to solve your problem. If you do not install InitialDirectory, then the last directory used is used in the dialog box. This information is stored in the registry, indexed by process name. You cannot selectively disable this behavior.

Windows. , Win7 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU. , . , , Windows. , , InitialDirectory.

+3

, OpenFileDialog, -, , -...

0

Source: https://habr.com/ru/post/1779866/


All Articles