Re: D6 and HTML help
- From: "Robert" <ngsemail2005withoutthis@xxxxxxxxxxxx>
- Date: Mon, 26 Feb 2007 10:05:32 -0500
"Roger Lascelles" <rogerlasAToptusnet.com.au> wrote in message
news:45e2c89e$1@xxxxxxxxxxxxxxxxxxxxxxxxx
"David J Taylor"
<david-taylor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:45e1bb5f$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Robert wrote:
Thanks. My app was crashing when closing, I'll try yor code which seems to
address that problem.
Robert
The stuff from Helpware (free) works fine for me on Delphi 5:
http://www.helpware.net
THe helpware information is good and 1000s of Delphi programs run on it.
So
post your specific problem! I use the ehshhapi.pas along with this:
unit Help;
interface
type THelpManager = class
private
FHtmlHelpFileName : string;
function HelpHook( Command : Word; Data : Longint; var CallHelp :
boolean ) : boolean;
public
property HtmlHelpFileName : string
read FHtmlHelpFileName write FHtmlHelpFileName;
constructor Create;
destructor Destroy; override;
procedure ShowContents;
end;
implementation
uses Windows, Forms, ehshhapi;
// function IsDebuggerPresent : BOOL; external Kernel32 name
'IsDebuggerPresent';
constructor THelpManager.Create;
begin
// load HHCTRL.OCX which provides WinHelp
LoadHH;
// Hook help requests into this object
Application.OnHelp := HelpHook;
end;
destructor THelpManager.Destroy;
begin
// unhook from TApplication
Application.OnHelp := nil;
if HHLoaded then begin
// html help can crash if help open when app closes, so close
beforehand
HtmlHelp( 0, nil, HH_CLOSE_ALL, 0 );
// this hack stops crash on shutdown - seen in Delphi IDE - html
help
// creates a thread to perform the task and OCX may be terminated
// before thread is finished with. Sleep seems to allow the
// thread to return.
Sleep(0);
end;
end;
// Handle Help Messages from HelpContext property of Forms and Controls
function THelpManager.HelpHook( Command : Word; Data : Longint; var
CallHelp
: boolean ) : boolean;
begin
if HHLoaded and
(FHtmlHelpFileName <> '') and
( Command in [Help_Context, Help_ContextPopup] ) then begin
// divert to HTML Help Context call
HtmlHelp( 0, pChar( FHtmlHelpFileName ), HH_HELP_CONTEXT, Data );
end;
// VCL should not call WinHelp
CallHelp := false;
// this function succeeded
result := True;
end;
// chose contents section of Help File
procedure THelpManager.ShowContents;
begin
if HHLoaded and
(FHtmlHelpFileName <> '') then begin
HtmlHelp( 0, pChar(FHtmlHelpFileName), HH_DISPLAY_TOC, 0 );
end;
end;
end.
----------
In my main form or similar, I initialise the chm help with:
TMainform = class(TForm)
..
protected
HelpManager : THelpManager;
end;
procedure TMainForm.FormCreate(Sender: TObject);
const
HelpName = 'myhelpfilename.chm';
begin
// start up help system
HelpManager := THelpManager.Create;
HelpManager.HtmlHelpFileName := ExtractFilePath(ParamStr(0)) +
HelpName;
end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
HelpManager.Free;
end;
Now the HelpContext properties in all the forms work with my CHM help
context values. Put the CHM file in with your EXE file.
Roger Lascelles
.
- References:
- D6 and HTML help
- From: Robert
- Re: D6 and HTML help
- From: David J Taylor
- Re: D6 and HTML help
- From: Roger Lascelles
- D6 and HTML help
- Prev by Date: Re: Is there some sort of portable Copy Protection??
- Next by Date: TJSDialog - 1.0.027 Update now available
- Previous by thread: Re: D6 and HTML help
- Next by thread: Re: D6 and HTML help
- Index(es):