Show: Delphi C++
Display Preferences

Controlling When Forms Reside in Memory

From RAD Studio
Jump to: navigation, search

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:

Application.CreateForm(TForm1, Form1);
Application->CreateForm(__classid(TForm1), &Form1);

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.

Topics

See Also

Personal tools
In other languages
Previous Versions
Assistance