I suspect that to use A-links you need to do the following:
- Assign an
Application.OnHelp
handler as described below. - Assign
Application.HelpFile
during program startup. - Call
Application.HelpKeyword
if you wish to invoke the help system with an A-link. - Set the
HelpKeyword
property for any GUI controls that you wish to respond to context sensitive F1 key presses.
The OnHelp
handler looks like this:
function TMainForm.ApplicationHelp(Command: Word;
Data: THelpEventData; var CallHelp: Boolean): Boolean;
var
Link: THH_AKLink;
ALink: string;
begin
CallHelp := False;
Result := True;
//argh, WinHelp commands
case Command of
HELP_COMMAND:
begin
ZeroMemory(@Link, SizeOf(Link));
Link.cbStruct := SizeOf(Link);
ALink := PChar(Data); // we are going to re-purpose the keyword as an A-link
Link.pszKeywords := PChar(AnsiString(ALink)); // seems we have to pass a PAnsiChar ..
Link.fIndexOnFail := True;
HtmlHelp(GetDesktopWindow, Application.HelpFile, HH_ALINK_LOOKUP,
DWORD_PTR(@Link));
end;
end;
end;
The HtmlHelpViewer
unit contains methods named LookupALink
which do the same. But I don't see how they could ever be called.
The above approach is a little bit hacky because it interprets keywords as A-Links. If you want context sensitive help, I can't see what else you can do.