Show: Delphi C++
Display Preferences

Enabling Help in Applications

From RAD Studio
Jump to: navigation, search

Go Up to Building Applications, Components, and Libraries Index

Note: Almost all of the Help features described in this section can be used in both Delphi and C++ applications in almost exactly the same way.

VCL applications support displaying Help using an object-based mechanism that allows Help requests to be passed on to one of multiple external Help viewers. To support this, an application must include a class that implements the System.HelpIntfs.ICustomHelpViewer interface (and, optionally, one of several interfaces descended from it--Help System Interfaces) and that registers itself with the global Help Manager.

The VCL library provides the Vcl.HtmlHelpViewer unit. The implementation section of this unit defines the internal THTMLHelpViewer class, which implements all of these interfaces and provides a link between applications and the HTMLHelp Windows help viewer. (See the MSDN library for information about the HTMLHelp function.) The initialization section of the Vcl.HtmlHelpViewer unit creates the instance of the THTMLHelpViewer class:

 HelpViewer := THTMLHelpViewer.Create;
 HelpIntfs.RegisterViewer(HelpViewerIntf, HelpViewer.FHelpManager);

Here, the THTMLHelpViewer.Create constructor internally creates the HelpViewerIntf Help Viewer object of the THTMLHelpViewer class. The second call passes this Help Viewer object to the global System.HelpIntfs.RegisterViewer function, which registers the created Help Viewer and returns the HelpViewer.FHelpManager Help manager. The global System.HelpIntfs.GetHelpSystem function can be called from other units to access Help methods from the registered Help Viewer. In this way you can get access to implementations of all methods declared in the System.HelpIntfs.ICustomHelpViewer interface (and other interfaces of HelpIntfs) and that are implemented in the THTMLHelpViewer class.

Delphi and C++ Requirement

  • If you want to use the HTMLHelp help viewer in your Delphi application, then you need to insert the Vcl.HtmlHelpViewer unit into the uses clause of your application.
  • In C++ applications, you need to add the #include Vcl.HtmlHelpViewer.hpp directive.

The Help Manager maintains a list of registered viewers and passes requests to them in a two-phase process: it first asks each registered Help Viewer whether it can provide support for a particular Help keyword or context ID, and then it passes the Help request to the Help viewer that says that it can provide such support.


Personal tools
In other languages
Previous Versions