For the Help Manager to communicate with them, objects that implement ICustomHelpViewer, IExtendedHelpViewer, ISpecialWinHelpViewer, and IHelpSelector must register with the Help Manager.
To register Help system objects with the Help Manager, you need to:
- Register the Help Selector.
- Register the Help viewer.
Registering Help selectors
The unit that contains the object implementation must use either Forms in the VCL or QForms in CLX. An instance of the object must be declared in the .cpp file of the implementing unit.
The implementing unit must register the Help selector through the HelpSystem property of the global Application object:
This procedure does not return a value.
Registering Help viewers
The unit that contains the object implementation must use HelpIntfs. An instance of the object must be declared in the header file of the implementing unit.
The implementing unit must include a pragma startup directive that calls a method that assigns the instance variable and passes it to the function RegisterViewer. RegisterViewer is a flat function exported by HelpIntfs.pas, which takes as an argument an ICustomHelpViewer and returns an IHelpManager. The IHelpManager should be stored for future use.
The corresponding .cpp file contains the code to register the interface. For the interface described above, this registration code looks like the following:
Global = dynamic_cast(GlobalClass);
#pragma startup InitServices
Note: The Help Manager object must be freed in the destructor for the GlobalClass object if it has not already been freed.