I have started to study for the MCAD. So after getting the books (I cannot afford the training courses), I started to read. However, as life is busy, I either had to carry a number of heavy books around, or sit in front of a PC which is not always possible. I was then lucky enough to get a Pocket PC for Christmas. But Pocket PCs do not come with a CHM Reader, and the ones available on the web are not free, or do not handle large CHM files well. So I decided to write my own and this is the result. A FREE CHM Reader which can handle large CHM files (Tested up to 14Mb in size). This program has only been tested on the Pocket PC 2003 on an IPaq 5550.
This CHM Reader is a MFC Doc List application, which uses a number of good libraries.
VOImage
, VOString
VORegistry
classes CSTHtmlDialog
CHMLib
Library Thanks to all these people for the great code they have contributed to the web.
CHMReader first displays a DocList (MFC's) of all the CHM files in the selected directory of the PocketPC. When the user selects one of them, MFC creates a new CCHMReaderDoc
instance which will then use CCHMFile
class. This class handles the CHMLib
library. The CHM file is then opened, and the CCHMFile
class will build a list of all the files contained in the CHM file. It also builds a Tree list of the contents. This is then displayed in the CCHMReaderView
class. This shows the contents of the CHM File. The user can then select one of the items in the contents, and a new dialog is displayed. This dialog contains the Pocket PC Internet Explorer control. The HTML file is extracted from the CHM file using the CCHMFile
class the CHMLib
library. The HTML is also scanned for any Style Sheet entries. These are then also extracted from the CHM file. Then the IE control is initialized with the HTML for display.
One thing to note is that the images are extracted from the CHM file as the IE control needs them. When the IE control loads the HTML, it will ask for each image in turn by way of a notification message. When I handle the notification, I simply extract the image from the CHM file into a buffer. It is then uncompressed using the VOImage
class. It is then passed back to the IE control.
I also added a few simple extras like the ability to change the text size, toggle 'Clear Text' 'Fit to Window' as these are all implemented by the IE control. I also added '' and '>' buttons to the toolbar to allow the user to navigate back and forth in the contents list easily.
Also note: If one CHM file requires files from other CHM files (Windows CHM Help Files) then if the files are present, CHMReader will try to get the files required, but it does not always.
Just copy the CHMReader.EXE any CHM files to your PocketPC, and run.
To build the CHMReader, I used embedded Visual C V4 SP2.