Variables
When using dynamic linking (HTMLHELP_DYNAMIC_LINK is defined) the HtmlHelp function is actually a function variable of the appropriate type. The variables are declared in the interface section but are maintained by the interface unit. You should consider them to be functions as opposed to variables and treat them accordingly (readonly). If you manually change their values (which could be usefull in some situations) you are on your own, be shure you know what your doing.
The implementation section has another global variable called HtmlHelpLib. After calling the LoadHtmlHelp function this variable contains the result of the LoadLibrary call which is a handle to the loaded library (hhctrl.ocx). If the LoadHtmlHelp function hasn't been called yet, the library was unloaded by a call to UnLoadHtmlHelp or the LoadHtmlHelp function failed this variable will have a value of 0.
type
THtmlHelpA = function (hwndCaller: HWND; pszFile: PAnsiChar;
uCommand: UINT;
dwData: DWORD{$IFDEF HTMLHELP12}_PTR{$ENDIF}): HWND; stdcall;
THtmlHelpW = function (hwndCaller: HWND; pszFile: PWideChar;
uCommand: UINT;
dwData: DWORD{$IFDEF HTMLHELP12}_PTR{$ENDIF}): HWND; stdcall;
THtmlHelp = THtmlHelpA;
var
HtmlHelpA: THtmlHelpA = nil;
HtmlHelpW: THtmlHelpW = nil;
HtmlHelp: THtmlHelp = nil;
// implementation
var
HtmlHelpLib: THandle = 0;