Click here to Skip to main content
Click here to Skip to main content

Automatic HTMLHelp Documentation for COM type libraries

By , 6 Mar 2003
 

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Philipos Sakellaropoulos
Web Developer
Greece Greece
Member
Software developer and Microsoft Trainer, Athens, Greece (MCT, MCSD.net, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralRe: _THE_ tool I was lookin' formemberPhilipos Sakellaropoulos27 Oct '04 - 3:20 
Thanks. Does it work ok? Usually people here write to complain Smile | :)
 
--- Remember yourself !! --------
GeneralRe: _THE_ tool I was lookin' formemberMr. Bit27 Oct '04 - 7:15 
Works better than any other free tool I've been testin' lately (I have probs convincing my boss to spend 500 bucks for Doc-o-matic - but that's another story Cry | :(( ).
 
To be honest Smile | :) , had to add one error-handler - to get rid of 'Subscript out of range' which abort's generating files (mostly when dealing with imported interfaces).
Only 1 of a dozen TLB's gives me a headache - because of a read error within TLBINF32.dll. I'm reactivating my VB-knowledge to get more familiar with your code - hard one after a century C++, but possible.
Any useful hint regarding the read error with TLBINF32?
GeneralVery Good onememberkrssagar30 Jun '04 - 18:15 
Very Nice tool ..Good job
Thank you very much ..
 
Could you pls tell how can i generate the documentation in C++/VC++ format ?
The documents generated by this tool in VB Syntax .
 
All suggestions are welcome ...
 
Thanx in advance
GeneralDocedit errorsussAnonymous26 May '04 - 2:47 
There is an error in DocEditTool.exe: entries in the 'Example code' textbox are not added to the XML file. This is fixed in the DocEditTool project (which needs to be compiled), however.
GeneralBug when asussSébastien FOUCAULT20 May '03 - 0:04 
First of all, congratulations for that really useful tool !
 
Several COM Components of my type library have proprietes or methods sharing the same names and prototypes (Add, Count and Items properties of collections for example).
In such cases, I think the XML file generation overwrites already documented members.
 
Any ideas ?
GeneralRe: Bug when asussAnonymous20 May '03 - 0:44 
According to further tests, the problem comes from the XML editing tool, DocEditTool.
GeneralNice...memberRobert Edward Caldecott11 Apr '03 - 1:04 
...but I am now using doxygen to generate help directly from my IDL files (HTMLHelp included). If anyone wants a sample, let me know. Smile | :)
 

When I am king, you will be first against the wall.
GeneralRe: Nice...membersaltynuts20024 Mar '04 - 5:42 
sure dude post a sample. You know it's funny.. doxygen has probably one of the worst documentation ever (somebody please write a proper gui for it) and yea your idl sample would be nice. I end up making too many mistakes and omissions when I manually create the help files myself
GeneralErrormemberRanael6 Mar '03 - 3:12 
Hello,
 
I have looking so long for a tool that creates documentation for a com type library, but I also get an error if I start 'DocLibTool.exe':
 

 
Run Time Error 429
Active X Component can't create object
 

 
Could you check this????
 

 


 

 
Bye & thanks, Ranael.
GeneralRe: ErrormemberNiw13 Mar '03 - 1:48 
Hello,
 
Same error on Windows XP Pro
 

Great idea, again
bye
GeneralErrormemberrmorgese25 Feb '03 - 3:48 
On my PC "Windows 2000 server" SP5, MSXML 4.0 sp1 occoures this error.
 

---------------------------
DocLibTool
---------------------------
Microsoft VBScript runtime error
Object required: 'li_node'
line = 255, col = 6 (line is offset from the start of the script block).
 
Error returned from property or method call.
 

---------------------------
OK
---------------------------
 
Your idea is great.
 
Raffaele
 
P.S.
Sorry my bad english
GeneralError "File not found"memberHolger Persch20 Jan '03 - 20:04 
During the file generation process I always get the error "File not found". The XML and the XSL files were generated, but the help project file fails. Any suggestions for this?
 
Best regards
Holger Persch
GeneralRe: Error "File not found"memberPhilipos Sakellaropoulos7 Mar '03 - 8:18 
Sorry i forgot to include some files in the first installation file. I have sent a new installation file
 
--- Remember yourself !! --------
GeneralACtiveX can't create object error despite MSXML4 installedmemberpaul ghezzi18 Dec '02 - 5:20 
Hi,
 
I have the MSXML4 installed but I get the 'ActiveX can't create object' error as I try to generate any documentation from any COM component.
Moreover, if I try to open in VB the doclibtool.vbp I get the 'HTMLHelpWrapper component is missing' error.
 
Any clues?
 
Thanks,
 
PG

GeneralRe: ACtiveX can't create object error despite MSXML4 installedmemberPhilipos Sakellaropoulos18 Dec '02 - 5:30 
I'm sorry for these problems! In my system i have all the DLLs needed so i will make an installation program and will post it to the site.

 
--- Remember yourself !! --------
GeneralError Messagemembersikanderrafiq15 Dec '02 - 19:14 
When i press the button 'Generate all files' it gives error message
'ActiveX component can't create object'. Plz resolve my issue.
 
Sikander
GeneralRe: Error MessagememberPhilipos Sakellaropoulos16 Dec '02 - 12:04 
This program requires Microsoft MSXML4. If you don't have it, download th e appropriate installation file from Microsoft MSDN site (search for MSXML)
 
--- Remember yourself !! --------
GeneralRe: Error Messagememberpaul ghezzi17 Dec '02 - 2:00 
I have MSXML4 installed but I get the same error. Moreover, if I try to compile the doclibtool.vbp I cannot because the HTMLHelpWrapper component is missing.
 
My clues?
 
Thanks
 
PG
GeneralSuggestionmemberGiles10 Dec '02 - 6:39 
This is a great tool.
 
Was thinking what would make this fantastic is if was linked to the shell, so right clicking on a tlb file and seleting say 'HTML Help' in Explorer would bring up the help file.
 
May have a go at this if you don't mind, and send you what I come up with?
Generalmissing OCXmemberPhil Sidari9 Dec '02 - 11:43 
When I open up the DocLibTool project it complains about the missing VBPhillipUtils.ocx file. Is this OCX required for the application to work properly? It is not provided in your ZIP file.
 
Thanks.
 
- Phil
 
MCSE+I, MCSD, MCDBA
GeneralRe: missing OCXmemberPhilipos Sakellaropoulos15 Dec '02 - 7:37 
No this dll is not required. It has to do with some UI enhancement
 
--- Remember yourself !! --------
GeneralOutstanding! (but...)membersnakeware9 Dec '02 - 6:01 
I have a type library that will crash your app as soon as
I try to generate the project files.
 
If you would like, I can email you the offending TLB file.
 

GeneralRe: Outstanding! (but...)membersnakeware9 Dec '02 - 7:46 
A little more info....
 
The offending .tlb imports Interfaces from another
type library.
 
Additionally, this type library has many coclasses
that expose a common source (event) interface, but
your duplicate the documentation for that same event
interface in each of the coclasses.
 

GeneralRe: Outstanding! (but...)memberPhilipos Sakellaropoulos16 Dec '02 - 12:13 
Thanks for the information but i have not any plans to improve this code. It is not a professional solution Smile | :)
 
--- Remember yourself !! --------
QuestionWhat a good idea.memberGiles8 Dec '02 - 12:10 
Thanks,
 
Giles Smile | :)

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 7 Mar 2003
Article Copyright 2002 by Philipos Sakellaropoulos
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid