[Overview][Types][Classes][Variables][Index] |
Custom application class
uses |
singleinstance; |
The CustApp unit implements the TCustomApplication class, which serves as the common ancestor to many kinds of TApplication classes: a GUI application in the LCL, a CGI application in FPCGI, a daemon application in daemonapp. It introduces some properties to describe the environment in which the application is running (environment variables, program command-line parameters) and introduces some methods to initialize and run a program, as well as functionality to handle exceptions.
Typical use of a descendent class is to introduce a global variable Application and use the following code:
Application.Initialize; Application.Run;
Since normally only a single instance of this class is created, and it is a TComponent descendent, it can be used as an owner for many components, doing so will ensure these components will be freed when the application terminates.