Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Moving from CHM help to website help


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 9 - Last Post: Apr 13, 2015 10:23 AM Last Post By: S De
David Cox

Posts: 28
Registered: 7/6/07
Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 7:25 AM
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:

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;


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

Posts: 1,227
Registered: 12/16/99
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 9:58 AM   in response to: David Cox in response to: David Cox
David Cox wrote:

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;

This is form-class specific, as you have discovered.

You can use the application.OnShortcut event to handle a key globally.
The main problem there is that you don't have the context available, at
least not that easily. Application also has an OnHelp event you can try.


--
Peter Below (TeamB)

David Cox

Posts: 28
Registered: 7/6/07
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 11:21 AM   in response to: Peter Below in response to: Peter Below
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
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 11:03 AM   in response to: David Cox in response to: David Cox
David wrote:

ShellExecute(Handle,'open', PChar('iexplore.exe'), ...);

And if the user does not have IE installed, or have IE set as their default
browser? You should respect the user's configuration:

ShellExecute(Handle, nil, PChar('http://www.SomeWebSite.com/Help/Help.html?'+IntToStr(msg.HelpInfo.iContextType)), 
nil, nil, SW_SHOWNORMAL);


--
Remy Lebeau (TeamB)
David Cox

Posts: 28
Registered: 7/6/07
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 11:24 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
And if the user does not have IE installed, or have IE set as their default
browser? You should respect the user's configuration:

ShellExecute(Handle, nil, PChar('http://www.SomeWebSite.com/Help/Help.html?'+IntToStr(msg.HelpInfo.iContextType)), 
nil, nil, SW_SHOWNORMAL);


--
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
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 11:44 AM   in response to: David Cox in response to: David Cox
David wrote:

Not specifying a browser will not work as I have a "?" after the HTML
to jump to a help topic.

Yes, it will work. Windows will see that an HTTP url is being requested,
locate the user's default app for HTTP urls, and load the app passing the
full requested URL to it, query string and all. Works perfectly fine when
I try it.

Therefore, a browser needs to be specified.

No, it does not.

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.

Why not simply use the user's existing OS configuration instead of duplicating
it in your app's configuration?

--
Remy Lebeau (TeamB)
David Cox

Posts: 28
Registered: 7/6/07
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 12:21 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Aha! Your are right! My mistake as I was using:

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


which pulls up file explorer.

Your code example works as you described.

Thanks! Much appreciated.

Dave
David Cox

Posts: 28
Registered: 7/6/07
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 12:57 PM   in response to: David Cox in response to: David Cox
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:
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;


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

Dave
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 8, 2014 1:50 PM   in response to: David Cox in response to: David Cox
David wrote:

ShellExecute(Handle, nil,
PChar('www.SomeWebSite.com/Help.HTML?'+IntToStr(ContextID)), nil,nil,
SW_SHOWNORMAL);

You need to include the HTTP scheme in the front of the URL so Windows can
resolve it correctly in all versions and browsers:

ShellExecute(Handle, nil, PChar('http://www.SomeWebSite.com/Help.HTML?'+IntToStr(ContextID)), 
nil, nil, SW_SHOWNORMAL);

--
Remy Lebeau (TeamB)

S De

Posts: 16
Registered: 5/1/15
Re: Moving from CHM help to website help  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 13, 2015 10:23 AM   in response to: David Cox in response to: David Cox
Hi,

I am attempting to do the same thing. Move from chm help to webhelp. I'm having some issues with the context sensitivity using the methods described in this thread, and I was hoping one of you might be able to point me in the right direction. Please pardon my ignorance of javascript, which I'm sure will come out in my description below.

In short, if I call the webpage by name, everything works great, but if I try to do it by map id, it doesn't.

My tech editor is using Robohelp to create our webhelp. The Robohelp documentation is pretty terrible though (love the irony) and the user-created tutorials seem to indicate that I need to call the start project which is likely an *.htm file followed by "#<id=[ContextID]". But when I try that or using the question mark followed by the context id directly as described here, I think it's treating the entire thing as the file name, can't find it, and executes nothing.

Another difference for me is that the webhelp is not actually published on the web. Since it's part of an application that gets installed on private networks, I am just copying the files in the program directory where I install the application.

Unlike the chm help which requires some initial set up like the application help file, the webhelp doesn't need anything other than the calls in this thread, right? Can anyone give me any ideas for where I am going wrong? I guess one of my main problems is I guess I don't really know if the error is on my side or that my tech editor hasn't merged the Robohelp project correctly/set up the map ids correctly.

Thanks in advance for any suggestions.
SDE
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02