Delphi TOpenDialog / TSaveDialog last used path

Referring to my question for this answer: https://stackoverflow.com/a/167268/ , in particular, step 3 says: “Otherwise, if the application used the Open or Save As dialog box in the past, the last the path used is selected as the source directory. "

Where does Windows store this information?

Note. From experience, it seems that it is associated with the application file name without its path - that is, the same executable file that is copied in different directories “sees” the same latest path information, and when the exe file name changes, the dialogs point to the document directory user.

My actual interest is for testing purposes. I need to "reset" this information in order to test my application in conditions similar to the first.

+4
source share
2 answers

It is used in Windows XP HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU, and the format of each element looks like ExeFilename + Path with both zeros and in UTF-16LE format. The MRU list is stored as a string with a name MRUList.

Winxp regedit

Newer versions of Windows use HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRUboth HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRULegacy, and the format looks like ExeFilename + ItemIdList (ExeFilename in UTF-16LE and null terminated). The MRU list is represented by a list of DWORDs in a binary value with the name MRUListEx, and the list ends with 0xffffffff.

, Vista, , IFileDialog. LastVisitedPidlMRULegacy, , , GetOpen/SaveFileName / hook.

+4

- .

Windows 10 ( Windows, ), , "" .

:

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU

reset / , , (UNICODE) . , , .

+2

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


All Articles