LoadHtmlHelp

Loads and initializes the HTML Help library.

function LoadHtmlHelp: Boolean

This function will attempt to load the HTML Help library (hhctrl.ocx) and initialize the HtmlHelp function variable. Upon success the function returns True and you will be able to succesfully call the HtmlHelp function. Upon failure the function returns False and using the HtmlHelp function will result in an access violation. Note that when HTMLHELP_DYNAMIC_LINK is, but HTMLHELP_DYNAMIC_LINK_EXPLICIT is not defined the LoadHtmlHelp function is not available to the application but instead is automatically called in the modules initialization section. If HTMLHELP_DYNAMIC_LINK and are both defined, then you must call LoadHtmlHelp yourself, it is not done automatically.


function LoadHtmlHelp: Boolean;
const
  ProcNameA =
'HtmlHelpA';
  ProcNameW =
'HtmlHelpW';
  ProcName = ProcNameA;
var
  HHOCXPath: string;
begin
  Result := HtmlHelpLoaded;
  if Result and GetOCXPath(HHOCXPath) then
  begin
    HtmlHelpLib := LoadLibrary(PChar(HHOCXPath));
    if HtmlHelpLoaded then
    begin
      @HtmlHelpA := GetProcAddress(HtmlHelpLib, ProcNameA);
      @HtmlHelpW := GetProcAddress(HtmlHelpLib, ProcNameW);
      @HtmlHelp := GetProcAddress(HtmlHelpLib, ProcName);
      Result := Assigned(HtmlHelpA) and Assigned(HtmlHelpW);
      if not Result then UnLoadHtmlHelp;
    end;
  end;
end;