If somebody has an example of a normal application using CHM for help, I'd like to have it.
Either via lazarus' helpsystem or directly via the api
This is the code I used to implement CHM help for my Lazarus Windows application.
(*-----------------------------------------------------------------------------
Launch an external application
Adapted from Source: http://wiki.lazarus.freepascal.org/Executing_External_Programs
------------------------------------------------------------------------------*)
procedure LaunchCHMHelp(ProgramName: string);
var
AProcess: TProcess;
begin
try
// Create the TProcess object, and
// assign it to the var AProcess.
AProcess := TProcess.Create(nil);
// Use AProcess to execute the Microsoft HTML Help file in the windows directory
// The "10" in "-mapid 10 ms-its:" signifies the table of contents
AProcess.CommandLine := 'hh.exe' + ' ' + '-mapid 10 ms-its:' +
ExtractFilePath(Application.ExeName) + ProgramName;;
// Now that AProcess knows what the commandline is
// we will run it.
AProcess.Execute;
// Free AProcess
AProcess.Free;
except
MessageDlg('Le fichier << ' + ProgramName + ' >> est introuvable', mtError, [mbOK], 0);
end;
end;
The code below opens the CHM helpfile when F1 is pressed or when a toolbar button is clicked
procedure TfrmMainform.HelpContents1Execute(Sender: TObject);
begin
// Display the table of contents of the help file
LaunchCHMHelp('Helpfile.chm');
end;
"HelpContents1" is a TToolButton on the menu toolbar with its Shortcut property set to F1 i.e HelpContents1.ShortCut := 'F1'.
So pressing F1 or clicking on the TToolButton with open the CHM help file. You can use another shortcut if you wish. There are many other options that you can set at designtime under the Action property of the TToolButton.
Cheers,
JD