Mega Search
23.2 Million


Sign Up

Make a donation  
Moving from CHM help to website help  
News Group: embarcadero.public.delphi.oodesign

Hello,

I am moving from CHM help to website help.  I have added all the HTML files and images to my website.  As far as I can tell, Delphi does not provide a “website help” implementation.  What I am thinking is to trap the F1 help key and call the website help as in the following:

{code}
private
    procedure WMHELP(var Msg: TWMHelp); message WM_HELP;
....

procedure TForm1.WMHELP(var Msg: TWMHelp);
begin
  ShellExecute(Handle,'open', PChar('iexplore.exe'), PChar    ('www.SomeWebSite.com/Help/Help.html?'+IntToStr(msg.HelpInfo.iContextType)),  nil,   
  SW_SHOWNORMAL);
end;
{code}

This works well, but I am wondering is the best way to trap the F1 help and call the website help or I have missed something in Delphi?  

Secondly, the above code needs to be added to every form in the project to trap the F1 key.  Any ideas on how I could make this global to the project?

Thanks!

Dave

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 8-Jul-2014, at 10:25 AM EST
From: David Cox
 
Re: Moving from CHM help to website help  
News Group: embarcadero.public.delphi.oodesign
> And if the user does not have IE installed, or have IE set as their default 
> browser?  You should respect the user's configuration:
> 
> {code}
> ShellExecute(Handle, nil, PChar('http://www.SomeWebSite.com/Help/Help.html?'+IntToStr(msg.HelpInfo.iContextType)), 
> nil, nil, SW_SHOWNORMAL);
> {code}
> 
> --
> Remy Lebeau (TeamB)

Remy,

Not specifying a browser will not work as I have a "?" after the HTML to jump to a help topic.  Therefore, a browser needs to be specified. What I am doing is enabling the user to specify the browser that want to use and default to IE if one is not given.

Dave

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jul-2014, at 2:24 PM EST
From: David Cox
 
Re: Moving from CHM help to website help  
News Group: embarcadero.public.delphi.oodesign
Aha!  Your are right!  My mistake as I was using:

{code}
ShellExecute(Handle,'open', PChar(''), PChar    ('www.SomeWebSite.com/Help/Help.html?'+IntToStr(msg.HelpInfo.iContextType)),  nil, SW_SHOWNORMAL);
{code}

which pulls up file explorer.

Your code example works as you described.

Thanks!  Much appreciated.

Dave

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jul-2014, at 3:21 PM EST
From: David Cox
 
Re: Moving from CHM help to website help  
News Group: embarcadero.public.delphi.oodesign
I have it working perfectly.  Thanks for the help!

In my main form FormCreate I added 

  Application.OnHelp:=AppHelp;

And the code to handle the help is as follows:
{code}
function TForm1.AppHelp(Command: Word; Data: NativeInt; var CallHelp: Boolean): Boolean;
begin
  CallHelp:=false;
  DisplayHelp(Data);  //Data hold the context help ID
end;

procedure TForm1.DisplayHelp(ContextID:integer);
begin
  ShellExecute(Handle, nil, PChar('www.SomeWebSite.com/Help.HTML?'+IntToStr(ContextID)), nil,nil, SW_SHOWNORMAL);
end;
{code}

F1 on any form pulls up the help with the correct help topic.

Dave

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jul-2014, at 3:57 PM EST
From: David Cox
 
Re: Moving from CHM help to website help  
News Group: embarcadero.public.delphi.oodesign
>Application also has an OnHelp event you can try.

Thanks Peter.  I will try the OnHelp event and see if I can get that to work the way I want.

Dave

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jul-2014, at 2:21 PM EST
From: David Cox