March 2000
Intermediate to advanced
576 pages
18h 13m
English
MainInstance Variable
var MainInstance: LongWord;
The MainInstance variable stores the instance
handle of the main program (.exe
file).
Any unit in a package can refer to MainInstance to
obtain the handle of the main application. Even packages loaded into
separate DLLs can use MainInstance.
A library that does not use the vcl50 package,
however, cannot use MainInstance, which is zero in
this case.
// The MAINICON resource is stored in the project's resource file, // which is in the main module. To load the icon resource, you // must use the main module's instance handle. This function // loads the MAINICON resource and returns its handle. function LoadMainIcon: HICON; begin Result := LoadIcon(MainInstance, 'MAINICON'); end;
| FindClassHInstance Function, FindHInstance Function, HInstance Variable, ModuleIsLib Variable, ModuleIsPackage Variable |
Read now
Unlock full access