// Call HTML help (.chm file)
function TOS3MainFrm.HelpHandler(Command: Word; Data: PtrInt;
var
s: String;
ws: UnicodeString;
res: Integer;
begin
if Command = HELP_CONTEXT then
begin
// see: http://www.helpware.net/download/delphi/hh_doc.txt
ws := UnicodeString(Application.HelpFile);
res := htmlhelp.HtmlHelpW(0, PWideChar(ws), HH_HELP_CONTEXT, Data); // Data is HelpContext here
end else
if Command = HELP_COMMAND then
begin
s := {%H-}PChar(Data);
// Data is pointer to HelpKeyword here, but the Windows help viewer does
// not want the KeywordPrefix required for LHelp.
if pos(HELP_KEYWORD_PREFIX + '/', s) = 1 then
Delete(s, 1, Length(HELP_KEYWORD_PREFIX) + 1);
ws := UnicodeString(Application.HelpFile + '::/' + s);
res := htmlhelp.HtmlHelpW(0, PWideChar(ws), HH_DISPLAY_TOPIC, 0);
end;
// Don't call regular help
CallHelp := False;
Result := res <> 0;
end;