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
> 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
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
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