GetOCXPath

Returns the path to the HTML Help library (hhctrl.ocx).

function GetOCXPath(var Path: string): Boolean

If the functions succeeds (return value is True) the Path parameter contains the absolute path to the HTML Help library (hhctrl.ocx). On failure the Path parameter is either empty or the absolute path to where the system thinks the HTML Help library is. Either way the library cannot be loaded. This function is used internally by the LoadHtmlHelp function and is not available to the application.

This function is an adapted version of the GetOCXPath function originally developed by Robert Chandler of The Helpware Group and included in his HTML Help Kit for Delphi programmers.


function GetOCXPath(var Path: string): Boolean;
const
  HHPathRegKey =
'CLSID\{adb880a6-d8ff-11cf-9377-00aa003b7a11}\InprocServer32';
begin
  with TRegistry.Create do
  try
    RootKey := HKEY_CLASSES_ROOT;
    
{$IFDEF DELPHI3}
    if OpenKey(HHPathRegKey, False) then Path := ReadString(
'');
    
{$ELSE}
    if OpenKeyReadOnly(HHPathRegKey) then Path := ReadString(
'');
    
{$ENDIF}
    Result := (Path <>
'') and FileExists(Path);
  finally
    Free;
  end;
end;