1.application variable (standard application)
Describe application-level information
unit
Forms
var Application: TApplication;
describe
By default, when you create a new project, Delphi constructs an Application object and assigns it to the Application variable located in the Forms unit. Application has several properties that can be used to obtain information about the application while the application is running.
Example
This code will display the name of your project in the edit box:
PRocedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := Application.Title;
end;
2.CmdShow variable
CmdShow is passed to the Windows API function ShowWindow.
unit
System
var CmdShow: Integer;
describe
In the program, when the application creates the main window, the CmdShow variable contains the parameter values that Windows expects to pass to ShowWindow.
In the library (DLL), CmdShow is always 0.
3.CompilerVersion constant
Specifies the version number of the Delphi compiler
unit
System
const CompilerVersion = 15.0;
describe
Use CompilerVersion to test the overall configuration level of the Delphi compiler. This is useful if you want to conditionalize code that takes advantage of newer features in the Delphi language.
4.ExitProcessProc variable
ExitProcessProc specifies the last procedure to be executed before the application is shut down.
unit
System
var ExitProcessProc: procedure;
describe
Assign to ExitProcessProc to specify the process you want to execute before the application closes. The value of ExitProcessProc is a procedure with no parameters.
5.GetFileVersion function
Return file version
unit
SysUtils
function GetFileVersion(const AFileName: string): Cardinal;
describe
GetFileVersion returns the most significant 32 bits of a file's binary version number. AFileName specifies the file name, which can be searched using the same path as the LoadLibrary function.
6.GetModuleName function
Returns the fully qualified name of the module for the given handle.
unit
SysUtils
function GetModuleName(Module: HMODULE): string;
describe
Call GetModuleFileName to obtain the fully qualified name of the module for the given handle.
Module is the handle of the module.
7.HInstance variable
Handle, provided by Windows to the module.
unit
SysInit
var HInstance: LongWord;
describe
HInstance holds an instance handle of an application or library provided by Windows
8.HintWindowClass variable
Specifies the class of the window used to display help hints.
unit
Forms
var HintWindowClass: THintWindowClass = THintWindow;
describe
When an application displays a Help Hint, it creates an instance of HintWindowClass to depict the window used to display the hint. Applications can customize this window by creating a derived class of THintWindow and then assigning the derived class to the HintWindowClass variable when the application starts.
9.InitProc variable
InitProc is the last initialization process installed.
unit
System
var InitProc: Pointer;
describe
Assign to InitProc to specify a procedure you want to execute when the application starts. InitProc is a parameterless procedure. For example:
procedure MyInitProcedure;
...
initialization
InitProc := @MyInitProcedure;
begin
end;
Only an initialization procedure can be assigned to the InitProc variable. If your application defines multiple initialization procedures, only the last one assigned to InitProc will be executed. To allow other initialization procedures to execute, you must "chain" the procedures together, calling the old value from the new value of InitProc. For example, the following code from the ComObj unit saves the original value of InitProc before assigning a new value, and then calls the saved value during the newly assigned initialization process:
SaveInitProc := InitProc;
InitProc := @InitComObj;
10.IsConsole variable
Indicates whether the module is compiled as a console application.
unit
System
var IsConsole: Boolean;
describe
If the module was compiled as a console application, the IsConsole variable is True. This will be True in both an executable and a DLL.
11.IsLibrary variable
Indicates whether the module is a DLL.
unit
System
var IsLibrary: Boolean;
describe
If the module is a DLL, then the IsLibrary variable is True.
12.JITEnable variable
Controls when the just-in-time debugger is called.
unit
System
var JITEnable: Byte = 0;
describe
Use JITEnable to indicate what type of exception will trigger the just-in-time debugger.
When JITEnable is 0 (the default value), all exceptions will be handled using the application's exception handling mechanism. The timely debugger is only called when the application does not provide any mechanism for catching exceptions. Note that except for the initialization and finalization areas in the Delphi unit, any application that includes the Forms unit provides exception handling (through the Application object) and does not trigger the timely debugger (Note that any application that includes the Forms unit provides exception handling (via the Application object) for all but the initialization and finalization sections and does not trigger the just-in-time debugger).
When JITEnable is 1, any non-native exception (thrown by code compiled using other products). will trigger the real-time debugger. Native exceptions are handled by the application's exception handling mechanism.
When JITEnable is greater than 1, all exceptions will trigger the real-time debugger.
NOTE: When you install the IDE, it is registered as a timely debugger. If you installed other tools with debuggers, they may have registered themselves, overwriting the IDE's registration.
13.Languages function
List the locale for which support is available.
unit
SysUtils
function Languages: TLanguages;
describe
Use the value returned by Languages to obtain information about the locales supported by the system. This function is only available on Windows platform
14.MainInstance variable
Indicates the instance handle of the main executable file.
unit
System
var MainInstance: LongWord;
describe
Use MainInstance to obtain an instance handle to the main executable file in an application. This is useful in applications that use runtime libraries or packages when you need a handle to the executable file rather than the library.
Note: Do not use MainInstance when running a CLX dynamic link library (Windows) or shared object (Linux) from an executable compiled with other tools.
15.MainThreadID variable
Indicates the main execution thread in the current module.
unit
System
var MainThreadID: LongWord;
describe
Use MainThreadID to obtain the thread ID of the main execution thread (the current thread when the module is initialized).
While debugging, this main thread ID is displayed in the thread status box.
On Windows, the MainThreadID value is compatible with the thread ID required by some Win32 API calls.
16.NoErrMsg variable
Controls whether the application displays an error message when a runtime error occurs.
unit
System
var NoErrMsg: Boolean = False;
describe
On Windows, set NoErrMsg to control whether a message is displayed indicating that a run-time error has occurred. When NoErrMsg is false (the default), runtime errors cause the application to display a message box proposing the type of error that occurred. When NoErrMsg is true, these messages will be suppressed.
On Linux, NoErrMsg has no effect.
Note: The SysUtils unit will convert most runtime errors into exceptions. If your application includes SysUtils, the runtime error message box may not be displayed even if NoErrMsg is false.
17.PopupList variable
Provides centralized processing of Windows messages sent to popup menus
unit
Menus
var PopupList: TPopupList;
describe
Use PopupList to access all popup menus in the application or to access the window handle of the window that responds to popup menu messages. PopupList maintains a list of all popup menu components created in the application. This list holds a handle to a hidden window that centrally handles Windows messages sent to these pop-up menus.
18.RTLVersion constants
Indicates the version number of the Delphi runtime library.
unit
System
const RTLVersion = 15.0;
describe
Use RTLVersion to check the version number of the Delphi runtime library that does not depend on the compiler version level.
19.Screen variable
Represents a screen device
unit
Forms
var Screen: TScreen;
describe
The Screen variable is a TScreen component that represents the screen of the system where the application is running. By default, the application creates a screen component based on information about the current screen device and assigns it to the Screen variable.
20.Win32Platform variables
Specifies the identifier of the Win32 platform
unit
SysUtils
var Win32Platform: Integer = 0;
describe
Win32Platform is used to identify the type of Win32 platform the system is running on. This will be one of the following values:
Value meaning
VER_PLATFORM_WIN32s system is Win32
VER_PLATFORM_WIN32_WINDOWS system is Windows 95
VER_PLATFORM_WN32_NT The system is Windows NT
Win32Platform is only available on Windows.