1

The Delphi VCL TFileOpenDialog has a property called ClientGUID. Embarcadero documentation says it:

...holds a GUID associated with a dialog's persisted state. Persisted states for a dialog can include such things as its position and size...

But that is all it says. I would like to know more. My testing shows that the dialog Size and Position do persist between application sessions so they are being stored somewhere.

But where is this information being stored? (I have searched the registry and hard drives for the GUIDs I have been testing but cannot find them anywhere.)

And, is it only Size and Position or do other properties also persist? (If it is only Size and Position then it's not really very useful to me.)

plumothy
  • 31
  • 3
  • Read more about it in MS docs, https://learn.microsoft.com/sv-se/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setclientguid?redirectedfrom=MSDN – LU RD Feb 03 '20 at 15:29
  • @LURD except that doesn't answer the question of WHERE the state is stored – Remy Lebeau Feb 03 '20 at 15:39
  • 1
    It doesn't matter where it is stored. That is a private implementation detail. – David Heffernan Feb 03 '20 at 19:08
  • What would you expect to be stored beyond size and position? – David Heffernan Feb 03 '20 at 19:13
  • I don't know what to expect, which is why I am asking. MS documentation says "A dialog's state can include factors such as the last visited folder and the position and size of the dialog". This is not explicit: "...can include.." implies it may include or may not include and "...factors such as..." just gives some examples. I would like to know what is stored so that I can know what I have to do myself and what I can leave to the automated system. I asked WHERE it is stored so I can go there and see WHAT is stored. – plumothy Feb 04 '20 at 08:35
  • Since that information is not given by MS, it is not meant to be used outside the current implementation. If you want more things to be handled, implement it yourself. – LU RD Feb 04 '20 at 10:51
  • I would expect that they have been purposely ambiguous so that if they store more information in the future, and forget to update docs, they will still be ok – David Heffernan Feb 04 '20 at 15:02

1 Answers1

1

I also asked this question on Experts Exchange and the answer given there is that the persisted properties are stored in the Windows Registry in this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\CIDSizeMRU

The values stored there are binary, which explains why the initial text searches for my GUID failed.

My testing shows that the persisted properties for FileOpenDialog include size, position and path. There may be be more but I don't know.

plumothy
  • 31
  • 3
  • [This answer](https://stackoverflow.com/a/32334732/2306907) hints, that the binary data, that is encoded, is the name of the exe. – yonojoy Feb 11 '20 at 19:20
  • 1
    Yes. If ClientGUID was given when executing the dialog then the GUID is stored in the binary data, otherwise it is the EXE name that is stored. – plumothy Feb 14 '20 at 10:17
  • Interesting! Is this documented somewhere or did you find this out by trying? – yonojoy Feb 14 '20 at 12:44
  • The registry key came from an Experts Exchange user. The rest was trial and error. – plumothy Feb 15 '20 at 14:10