Question

The "A" in A-links and A-keywords stands for "associative". This is because A-link keywords are actually not keywords at all. They are more like link or jump targets (known as anchors in H&M). They are never visible to the user like index keywords. They are known as "associative" because they are not absolute targets.

How to call CHM help by A-keyword in Delphi XE?

Was it helpful?

Solution

The Windows API function HTMLHelp is directly available in the Windows unit. You want the HH_ALINK_LOOKUP command.

If you're using the help system from HelpInfts, the HtmlHelpViewer unit contains THtmlHelpViewer, which contains various methods for dealing with ALinks - specifically LookupALink. Unfortunately, there seems to be no documentation of the type, so you'll have to drill down into the source yourself (it is quite simple, so you should not have too much trouble).

OTHER TIPS

I don't see any support for it in helpintfs.

I tried myself once with D2006/FPC, and commited the results to FPC:

You'll need the unit "htmlhelp" from

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/winunits-base/src/htmlhelp.pp?view=co

and do some ansi->unicode translation in that file (e.g. change all pchar to pansichar, replacint ptr(u)int with native(u)int etc)

This file has a constant HH_ALINK_LOOKUP that afaik can be used to lookup alinks and keywords.

This can be passed to the htmlhelp function. The below code is from Free Pascal and uses ansistrings, but it probably works analogous in Delphi

{$apptype console}
Uses HTMLHelp;

var
   keyword      : ansistring;
   HelpfileName : AnsiString;
   htmltopic    : AnsiString;
   res          : Integer;
   ah           : PHH_AKLINK ;

Begin
  Helpfilename:='rtl.chm';
  keyword:='Sysutils' ;

  New(ah);
  fillchar(ah^,sizeof(ah^),#0);
  ah.cbstruct:=sizeof(tagHH_AKLINK);
  ah.fReserved   := FALSE ;
  ah.pszKeywords :=pansichar(keyword);
  ah.pszUrl      := NIL ;
  ah.pszMsgText  :='Text succes' ;
  ah.pszMsgTitle :='Text fail';
  ah.pszWindow   := NIL ;
  ah.fIndexOnFail:= false;


  Res:=HtmlHelpA(0,pansichar(helpfilename) ,HH_DISPLAY_INDEX,PTRUINT(PAnsiChar(Keyword)));

  // keyword search seems to have same effect.
  Res:=HtmlHelpA(0,pansichar(helpfilename) ,HH_ALINK_LOOKUP,PTRUINT(AH));
  writeln(ah.pszkeywords);
  writeln(ah.pszurl);
  writeln(ah.pszmsgtext);
  writeln(ah.pszmsgtitle);
  writeln(ah.pszwindow);
  writeln(res);

 readln;
end.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top