Where does Delphi store the desktop settings? And what do they mean?

I keep forgetting this so this post is mostly so I can look it up:

Delphi uses DST files to store the desktops – that is the layout of the various parts of the IDE. Theses files are in INI format and are stored in

Delphi 2007 and later
[users]\[username]\AppData\Roaming\[Company]\BDS\[version]
e.g. c:\users\johndoe\AppdData\Roaming\Embarcadero\BDS\20.0
Delphi 2006 and older
[programfiles]\[company]\[Delphi X]\bin
e.g. c:\program files\Borland\Delphi 7\bin

Since AppData is a hidden directory, a search for *.dst in the Windows Explorer will not find these files. An easy way to get to AppData is opening an Explorer Window and typing %appdata% into its address field.

Why would you want to find these files?

Delphi 10.3 has a very annoying bug where it does not store the window position correctly. E.g. I move the IDE window to my secondary monitor and maximize it. When I exit and restart it, the Window will appear somewhere on my primary monitor and usually be very small. Editing the DST file fixed that for me.

NOTE: The following applies to Delphi 10.3 Rio. Old versions stored the size and position in pixels. I don’t know when exactly they switched to “percentages”.

WARNING: If you write invalid values into the file, the IDE will crash on startup (We call that “failing gracefully”. 😉 ) So be sure to always keep a backup of a working file (or copy one of the default files over your borked file if you run into problems).

I set the following entries:

[Main Windows]
PercentageSizes=1
State=0
Left=-10000
Top=0
Width=10000
Height=10000

PercentageSizes apparently means that the values are stored as percentages of the actual width and height of the monitor, for an appropriate meaning of “percentage”, in this case 1/10000, so 10000 means: Use the full width and height. The same goes for Top and Left. My secondary monitor is to the left of the primary one, that’s where the -10000 value for Left is coming from.

State=0 means that the window state is normal, that is: not maximized (and also not minimized, but who wants a minimized window for this?). State=2 means maximized and is what does not work for me at all.