Implement EHS in Delphi7

This section is for programmers. Please use it for all discussons on interfacing help with your applications and related subjects.

Moderators: Alexander Halser, Michael Schwarzl

Post Reply
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Implement EHS in Delphi7

Unread post by BHousley »

1st of all I am not a Delphi7 programmer by a long shot but have no choice at this point.

We are running Delphi7 and that will not be changing.

I need to stop using .HLP files and get moved to .CHM files. I already have a tool to
create the .CHM file.

I have tried HTMLHelpViewer.pas. Was easy to implement. All I get was air when I click
on Help-Help Topics.

I have tried D6OnHelpFix.pas. Was easy to implement. All I get was air when I click
on Help-Help Topics.

I am now trying EHS.

I have added ehshelprouter.pas as a unit in a use statement

// Below added by BDH 11-14-14 then got a clean compile
ehshelprouter in 'ehshelprouter.pas';

My main form has an event called HelpTopics1, onClick runs HelpSpeedClick.

This is defined

procedure HelpSpeedClick(Sender: TObject);
procedure ExitSpeedClick(Sender: TObject);

As you can see I have been experimenting a little. But, what do I need here.

procedure TMainForm.HelpSpeedClick(Sender: TObject);
begin
// Changed by BDH 11-18-14
// Original Code is the one line of code below this line
// Application.HelpCommand(Help_Finder, 0);
// Below line added as replacement code
// ehshelprouter.HelpFile := AppPath() + 'Helpfile.chm';
ehshelprouter.HelpJump := ('helpfile.chm', 0);
end;

I know this is the place the old .hlp was working from, as I have been able to change the
symptoms when I click on it.

I would sure appreciate some assistance.
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Implement EHS in Delphi7

Unread post by Alexander Halser »

What do you mean by "All I get was air"?
Your code example does certainly not compile.
Please elaborate.
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

Thanks for the reply! I will be more specific. The code I displayed was work in
progress as a sample.

I do not plan on any type of context sensitive help. All I need to to click on
Help-Help Topics and open helpfile.chm in application folder.

As for "all I get is air". When I click on Help-Help Topics, nothing happens at all.

I also have helpfile.chm located in the same folder as the helpfile.hlp.

Now, this code compiles, builds, and opens helpfile.hlp just fine.

procedure TMainForm.HelpSpeedClick(Sender: TObject);
begin
// Changed by BDH 11-18-14
// Original Code is the one line of code below this line
Application.HelpCommand(Help_Finder, 0);
// Below line added as replacement code
// ehshelprouter.HelpFile := AppPath() + 'Helpfile.chm';
// ehshelprouter.HelpJump := ('helpfile.chm', 0);
end;

Now, I have eshhelprouter.pas in the use statement in the .dpr file as well as
the main form I am using.

As you can see I have tried variations of ehshelprouter and nothing worked. If you want
I can try all of the other options (HTMLHelpViewer.pas, and D6OnHelpFix.pas) and see
what I get.

If you let me know, I will be glad to try anything. I needed some busy work to keep an
other employee from being laid off for the winter, and creating the .CHM file is what
I gave him to do.
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Implement EHS in Delphi7

Unread post by Alexander Halser »

I do not plan on any type of context sensitive help. All I need to to click on
Help-Help Topics and open helpfile.chm in application folder.
In this case, a

Code: Select all

ShellExecute( Application.Handle, 'open', PChar( <helpfilewithpath.chm> ), nil, nil, SW_NORMAL );
should do the job.
Alexander Halser
Senior Software Architect, EC Software GmbH
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

Ok, before I try this, as of right now our Delphi7 applications all run on XP Pro, up to and including Win 8.1.1 (32-Bit & 64-Bit). I will be testing Win 10 as soon as I solve this issue.

With that said, will your solution work across those operating systems?

Finally, I believe I do not need an add-on unit like ehs.., D6O.. or HTMLHelp.. to make the shell command work. Correct?
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Implement EHS in Delphi7

Unread post by Alexander Halser »

Ok, before I try this
Please try it. It's one line of code, not too much effort.
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

Using this code:

procedure TMainForm.HelpSpeedClick(Sender: TObject);
begin
// Changed by BDH 11-18-14
// Original Code is the one line of code below this line
// Application.HelpCommand(Help_Finder, 0);
// Below line added as replacement code
// ehshelprouter.HelpFile := AppPath() + 'Helpfile.chm';
// ehshelprouter.HelpJump := ('helpfile.chm', 0);
ShellExecute( Application.Handle, 'open', PChar(helpfile.chm), nil, nil, SW_NORMAL );
end;

Getting 2 compile errors:

Undeclared Identified 'ShellExecute"
Record, object or class type required
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Implement EHS in Delphi7

Unread post by Alexander Halser »

Include the unit ShellAPI in your uses clause, it's defined there.
Alexander Halser
Senior Software Architect, EC Software GmbH
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

Ok, that got it down to one error

Record, object, or class type required

ShellExecute( Application.Handle, 'open', PChar(helpfile.chm), nil, nil, SW_NORMAL );
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Implement EHS in Delphi7

Unread post by Alexander Halser »

BHousley, you need a crash course in Pascal programming :wink:

Quotes around strings are always required in Pascal and don't forget to include the full path to your help file. Simply specifying "helpfile.chm" might not be found.
Alexander Halser
Senior Software Architect, EC Software GmbH
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

If you only knew my friend....I am a trained programmer, that is what my degree is in. I actually was actually in a programming contest and took 3rd in nation...LMAO...13 Languages back then, but, that was in early 70's. Have not wrote line of code since early 90's. Been System and Network Admin since then. Bottom line, you never forget logic and technic's but you do forget syntax.

Got a clean compile testing now.

You are good man, will let you know.
BHousley
Posts: 7
Joined: Wed Nov 19, 2014 9:06 pm

Re: Implement EHS in Delphi7

Unread post by BHousley »

You are a hero my friend!

helpfile.chm opening and appears to be operational.

Now, what about these little possibilities:

As of right now our Delphi7 applications all run on XP Pro, up to and including Win 8.1.1
(32-Bit & 64-Bit). I will be testing Win 10 as soon as I solve this issue.

With that said, will your solution work across those operating systems?

Finally, I believe I do not need an add-on unit like ehs.., D6O.. or HTMLHelp.. to
make the shell command work. Correct?
Post Reply