Converting .hlp files to .chm


Explains how to convert windows help files from the old .hlp format to the newer HTMLHELP format (.chm) by using the winhelpcgi program.


The .chm (htmlhelp) file format introducted with windows 98 has obsoleted the older .hlp (winhelp) file format for windows help authoring. However there are still a lot of applications using the older format for various reasons. One of the problems involved with the transition is the fact that after converting an existing source code for a .hlp file into a sourcecode for a .chm file a lot of details have to be reworked since the converter program shipped by Microsoft with their Html Help Workshop is of rather limited quality.

We already addressed some of the problems involved with our older HTMLHELP tools which post-process the files created by Html Help Workshop to enhance their quality.

In winhelpcgi we have implemented a much better technology for the conversion of existing .hlp projects to .chm. It contains a technology we call tab-emulation to emulate the tabs missing in html publishing by using nested tables. It also uses CSS style sheets to represent the right formatting. In the end the resulting HTML files are of much higher quality than the ones created by  Microsoft Html Help Workshop.

Winhelpcgi creates a CHM sourcecode that can either be compiled using Microsofts Html Workshop or be viewed by packing it with zip into a .htb file and viewing it with the external wxwidgets help browser. Our chmviewer application should be fine.


You need:


  1. Install winhelpcgi.cgi
  2. Copy the .HLP file and the .CNT file (if you have one) into the directory where you installed winhelpcgi.cgi to.
  3. Change directory to this directory.
  4. Start winhelpcgi with parameter --tar and the relative filename of the .hlp file to convert.
  5. Redirect output of winhelpcgi.cgi --tar to the tar program to extract what you need.


# Install winhelpcgi. Here for debian
apt-get install winhelpcgi libwmf

# Copy help file
cp -p myfile.hlp myfile.cnt /usr/lib/cgi-bin/

# Change directory
cd /usr/lib/cgi-bin

# Convert file
./winhelpcgi.cgi --tar myfile.hlp | tar -C /tmp --extract --verbose

This will create /tmp/myfile.hlp/ directory with a lot of subdirectories.

See also


Latest News