Controlling When Forms Reside in Memory
Go Up to Using Forms
By default, Delphi automatically creates the main form of an application in memory by including the following code in the application's main entry point:
This function creates a global variable with the same name as the form. So, every form in an application has an associated global variable. This variable is a pointer to an instance of the class of the form and is used to reference the form while the application is running. Any unit that includes the unit of the form in its uses clause can access the form via this variable.
All forms created in this way in the project unit appear when the program is invoked and exist in memory for the duration of the application.
- Displaying an Auto-created Form
- Creating Forms Dynamically
- Creating Modeless Forms Such as Windows
- Creating a Form Instance Using a Local Variable