TPJWdwState & TPJRegWdwState Components



The file PJWdwState.pas includes two components - TPJWdwState and TPJRegWdwState.

The components can save the state (minimised, maximised or normal) of a form window, along with its size and position. TPJWdwState saves the information to an ini file while TPJRegWdwState saves to the registry. The components can also read information back and restore the saved window settings. This means the components can be used to restore a window to the condition it was in during some previous execution. This is acheived either by calling a couple of methods within code or setting the component to automatically save and restore the window on creation and destruction.

With TPJWdwState you can specify the name of the ini file, or let the component choose one. You can also decide the name of the section within the ini file that will be used. Again the component can provide a suitable default section name.

Similarly with TPJRegWdwState you can specify the registry root and sub-keys under which the information is saved. Again suitable default values are used if no keys are specified.

Also included in the PJWdwState.pas unit is the component TPJCustomWdwState along with a helper component. Neither of these components should be constructed directly and they are not registered with Delphi.

The zip file that contains PJWdwState.pas also contains an optional property editor in PJHKeyPropEdit.pas (TPJHKEYPropEditor) for editing the registry root key property of TPJRegWindowState.


The components and property editor have been tested with Delphi 4, 6 and 7. It is likely that they will work with Delphi 3 and 5, but this has not been tested. They are not compatible with Delphi 1 and 2.


In these instructions $(DELPHI) is to be taken to represent the path where the appropriate version of Delphi was installed. For example, if you have Delphi 4 installed on the default installation path then $(DELPHI) is equivalent to C:\Program Files\Borland\Delphi4.

To install, proceed as follows:

  1. Unzip the .zip file containing the components into a folder, preserving the directory structure.
  2. Copy PJWdwState.pas and PJWdwState.dcr to the folder from where you wish to install the component into the Delphi Component Palette. This will probably be a sub-folder of the $(DELPHI)\lib folder.
  3. If you wish to install the optional HKEY component editor contained in PJHKEYPropEdit.pas then copy this file to the same folder as PJWdwState.pas.
  4. Install the components and, optionally, the property editor, by chosing the Component | Install Component menu option then:
  5. You can now delete PJWdwState.pas (and PJHKEYPropEdit.pas if installed) from the place where you copied them if you wish. The components will appear on a palette called DelphiDabbler. You can move the components to a different palette as required.
  6. The simplest way to install the help file is to use my Component Help Installer Expert. To install manually, proceed as follows:

Known Issues

Update History

Release 4.2 of 30 October 2003
PJWdwState v4.1 of 30 October 2003
PJHKeyPropEdit v1.0.2 of 30 October 2003

Release 4.1 of 07 August 2002
PJWdwState v4.1 of 07 August 2002
PJHKeyPropEdit v1.0.1 of 08 October 2000

Release 4.0 of 17 March 2002
PJWdwState v4.0 of 17 March 2002
PJHKeyPropEdit v1.0.1 of 08 October 2000

Release 3.1.1 of 08 October 2000
WdwState v3.1 of 29 April 2000
PJHKeyPropEdit v1.0.1 of 08 October 2000

Release 3.1 of 29 April 2000
WdwState v3.1 of 29 April 2000

Release 3.0 of 05 April 2000
WdwState v3.0 of 05 April 2000

Release 2.1 of 29 November 1999
WdwState v2.1 of 29 November 1999

Release 2.0 of 19 October 1999
WdwState v2.0 of 19 October 1999

Release 1.0 of 15 August 1999
WdwState v1.0 of 15 August 1999


License & Disclaimer

These components are copyright © P.D.Johnson, 1999-2003.

The source code and help files can be freely distributed on a not-for-profit basis providing that:

  1. The source code is not altered.
  2. This readme file is distributed with it unchanged.

By not-for-profit I mean that you may recover out of pocket expenses incurred in distributing the code, but should not make a profit from this.

If you discover any bugs in this implementation, or if you have any update suggestions, please contact me via my website.

Please do modify the code for you own use. I'd like to see any changes you make - I could incorporate them into future versions. Please notify me of changes on at the above e-mail address.

This software is provided as is - no warranty is given as to its suitability for any purposes to which you may wish to put it.

About the Author

I'm Peter Johnson - a hobbyist programmer living in Ceredigion in West Wales, UK. I write mainly in Delphi. My programs are available for download on my web-site:

I can be contacted via the website.