1
votes

We are porting our app to Delphi XE2 from Delphi 6. Problem is, the help file will not display no matter what I try.

Using Delphi XE2 (Update 3) on Win 7 64.

Using a valid help file (.chm) that works with my Delphi 6-built app.

I create a simple app with one button that calls help thusly:

  Application.HelpFile := 'Help.chm';
  if Application.HelpFile <> '' then begin
    Application.HelpContext(0);
  end;

I have HTMLHelpViewer in my uses clause.

The help file is in the same directory as the app. When I click on the button the help file is not displayed! I see nothing. No errors.

I tried several different help files, all of which are valid and I can open via Explorer.

I also tried calling the table of contents directly like this:

HtmlHelp(0, Application.HelpFile, HH_DISPLAY_TOC, 0);

Nothing is displayed this way either.

What the heck am I missing here? This is a show stopper if I can't make the help file display when users hit the F1 key.

------ EDIT - PROBLEM SOLVED! ------

Sigh, I'm an idiot, but only partially. :)

The simple app indeed had the help file in the wrong directory. The new Delphi XE2 has the default output in a sub-directory, not the original directory like Delphi 6 used to do. I've been bitten by that twice now. :)

So, once I figured that issue out I had to go back to the original app and figure that one out.

It turns out we had our own HTMLHelpViewer.pas unit in the project (BIG project) and that conflicted with the built-in HTMLHelpViewer unit that comes with Delphi XE2.

Once I whacked our version of that file and removed it from the hard drive and added in Delphi's version everything works swimmingly.

Thanks for the knock on the head to help me figure this out.

2
Is the chm on the local drive or on network drive? There is a security feature which prevents opening chm files from non-local drives...ain
@ain When this happens, a window appears but the help content in missingDavid Heffernan
You've found it, but apart from that, it might not hurt to specify a fully-qualified path in Application.HelpFile.Marek Jedliński

2 Answers

4
votes

The only explanation that I can see, given the information that you have provided, is that the help file is not in the current working directory.

I would keep the working directory out of the equation and set Application.HelpFile to be the fully-qualified path to the help file.

0
votes

Was the helpfile installed by an installer?

If not, right click it and select "unblock" in the properties