1
votes

I am upgrading from Delphi 6 to Delphi XE. In Delphi 6 I was using HTML help files (.chm) and used the StoHtmlHelp to make it so that I could call context sensitive help like we used to call .hlp files. I'm upgrading to Delphi XE so I need to use that native HTML help support.

I know I'm supposed to add HTMLHelpViewer to the uses clause of the project, but when I do I get a compiler warning that it couldn't find the file.

Could not compile used unit 'HTMLHelpViewer.pas'

Does anyone know why Delphi isn't finding this file by default? It should be built in.

2

2 Answers

7
votes

Not being able to compile a file and not finding a file arent't the same thing. If Delphi is trying to compile HTMLHelpViewer.pas you must either:

  • have the vcl source folder(s) on your library path (not recommended), or
  • another HTMLHelpViewer.pas file is somewhere on your library path, that path comes before the standard Delphi lib folder, and that HTMLHelpViewer.pas file contains something that Delphi XE is not happy about.

The first is not likely and it would be very strange indeed if Delphi could not compile one of its units (apart from system.pas).

The second seems more likely... And if that unit used to compile, the complaints from Delphi XE could well be due to differences between Delphi 6 and Delphi XE.

3
votes

You don't actually need to add it the uses clause of the .dpr file – you just need to use it from some unit in your project.

Having said that, you may actually prefer to add it to your .dpr file, and if so then do it like this:

uses
  Forms,
  HtmlHelpViewer,
  MyUnit in 'MyUnit.pas',

I'm guessing that you have something like this:

uses
  Forms,
  HtmlHelpViewer in 'C:\Program Files\Borland\Delphi6\Source\VCL\HtmlHelpViewer.pas',
  MyUnit in 'MyUnit.pas',

This will fail because you are asking XE to compile D6 source.

For RTL/VCL units its best to omit the path to the file and let the compiler find it (it knows where to look).