Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Automatic HTMLHelp Documentation for COM type libraries

0.00/5 (No votes)
6 Mar 2003 4  
A tool that automatically generates HTMLHelp documentation of COM type libraries. You can then add explanations and example source code for your methods.

Sample Image - DocLibTool.jpg

Description

Tool for Documentation of Type Libraries (DocLibTool) is a VB6 program that helps you document Microsoft COM type libraries (and thus any COM component described in a type library) in HTML Help format. It created it while working in a company to help me create the documentation for some large COM objects. Information from the type library is extracted using the functions of the TypeLib Information component implemented in TLBINF32.DLL. Read the MSDN magazine article Visual Basic: Inspect COM Components Using the TypeLib Information Object Library for details about this component.

Basic use of the program is simple. You have to provide a source file containing a type library (*.EXE, *.DLL, *.TLB) created by any COM-enabled language (VC++, VB, Delphi, ...), point to a directory where all output files will be put and then press the "Generate files" button. The program will create a set of  HTML files describing the type library (objects, interfaces, methods, enumerations), an XML file having all this information in a structured way, an HTML Help Project file (.HHP) , a HTML Help Contents file (.HHC), a HTML Help Index file (.HHK). To compile the help file ( .CHM extension) you open HTML Help Project file with the Microsoft's HTMLHelp program and press the "Compile" button. If you don't have the HTMLHelp tool you can freely download it from Microsoft's MSDN site (search for 'HTMLHelp' and you 'll find it).

You can add your own customized information to the help file, by editing the XML file and filling the empty tags that exist for this purpose: CoClassDescription, InterfaceDescription, MemberDescription, ReturnValueDescription, ParameterDescription, ExampleCode, Related, EnumerationDescription. A program has also a visual editor that allows you to easily enter additional information for the methods (general description, parameters/return value descriptions, example source code). The editor saves this information in the XML file. You can also edit the Contents file and the Index file with the Microsoft HTMLHelp tool. Finally, you can also change the format of the HTML files and their structure (more difficult !) by editing the XSL files. When you re-generate the files (due to a change in the type library for example) all the custom information that you have entered in the XML is copied from the old file to the new one. If you have added entries in the contents or the index file they will be retained also. Information for each project is stored in a configuration file with the .dlt extension. The format of the file is the same as the format of INI files. 

Screenshot of the DocLibTool program

How to enhance the tool

Information extracted from the type library is saved in an XML file. XSL transformations (extended with some Microsoft VBscript code) are used to create the output files (HTML,etc.). If you want to improve the documentation that the tool produces, you can edit the following files that are used by it. These files are:

File name

Description

TemplateOfTypeLibInfo.xml Defines the structure of the generated description XML file. Do not edit it unless you can make the necessary changes also to VB code.
TemplateOfTLBParts.XSL This XSL file contains templates for HTML files, for HHC file and for HHK file. You can edit it to customize the appearance of the HTML files.
scripts.xsl Contains VBScript code used to implement tasks beyond the capabilities of the XSL stylesheet commands (for example save an XML fragment in disk). The functions it contains are called by the TemplateOfTLBParts.XSL. Better not modify any of the functions.
ie4.css Styles used in the HTML files

History

  • 13 Jan 2003 - added installation download
  • 7 Mar 2003 - updated installation download

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here