delphidelphi-xe2help-system

How to call a context help by A-link (A-keyword) on application for Delphi XE2?


How to call a context help by A-link (A-keyword) on application for Delphi XE2?


Solution

  • All you need is this function:

    procedure ShowHelpALink(const HelpFile, ALink: string);
    var
      Link: THH_AKLink;
    begin
      ZeroMemory(@Link, SizeOf(Link));
      Link.cbStruct := SizeOf(Link);
      Link.pszKeywords := PChar(AnsiString(ALink));
      Link.fIndexOnFail := True;
      HtmlHelp(GetDesktopWindow, HelpFile, HH_ALINK_LOOKUP, DWORD_PTR(@Link));
    end;
    

    For some reason HtmlHelp interprets the strings in the THH_AKLink record as ANSI strings. I cannot find any documentation on this. I suspect it is simply a bug in the HtmlHelp file library. I think that the strings that you pass in THH_AKLink must be ANSI strings.