Mega Code Archive

 
Categories / Delphi / Examples
 

Helpfiles

TO AVOID 'FILE NOT FOUND' ERRORS WITH HELPFILES, i) put the HelpFile in the 'startup' directory along with the .exe file, and ii) do this: const helpFileName = 'MyHelp.hlp'; procedure TSrchForm.HelpButtonClick(Sender: TObject); {run the Helpfile for the application -as it stands, the Helpfile must be in the STARTUP directory along with the associated contents file, so both Search.hlp and Search.cnt must be present...} var exeFileName, pathToExe, fileName: String; begin {because changing the directory in the file List box changes the overall 'current directory' such that the program won't find the Help file if we're not careful, we need to keep track of the path to the .exe (and therefore the .hlp) WHEN THE PROGRAM FIRST RUNS...} exeFileName := Application.ExeName; pathToExe := ExtractFilePath(exeFileName); fileName := pathToExe + helpFileName; Application.HelpFile := fileName; Application.HelpCommand(HELP_CONTENTS, 0); end;