Click here to Skip to main content
15,860,972 members
Articles / Programming Languages / Visual Basic
Article

Automatic HTMLHelp Documentation for COM type libraries

Rate me:
Please Sign up or sign in to vote.
4.79/5 (26 votes)
6 Mar 2003CPOL3 min read 155.4K   3.8K   56   28
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.xmlDefines the structure of the generated description XML file. Do not edit it unless you can make the necessary changes also to VB code.
TemplateOfTLBParts.XSLThis 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.xslContains 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.cssStyles used in the HTML files

History

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Forthnet
Greece Greece
Software developer and Microsoft Trainer, Athens, Greece (MCT, MCSD.net, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).

Comments and Discussions

 
Generalmissing OCX Pin
Phil Sidari9-Dec-02 11:43
Phil Sidari9-Dec-02 11:43 
GeneralRe: missing OCX Pin
Philipos Sakellaropoulos15-Dec-02 7:37
professionalPhilipos Sakellaropoulos15-Dec-02 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.