Click here to Skip to main content
15,891,253 members
Articles / Mobile Apps / Windows Mobile

CHM Reader for Pocket PC 2003

Rate me:
Please Sign up or sign in to vote.
4.91/5 (65 votes)
29 Feb 2004CPOL3 min read 476.8K   960   87   142
Allows the reading of CHM files on a Pocket PC2003.

Sample Image - pic004.jpg

Introduction

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.

The Code

This CHM Reader is a MFC Doc List application, which uses a number of good libraries.

  • Virtual Office Systems Incorporated - VOImage, VOString & VORegistry classes
  • Vassili Philippov - CSTHtmlDialog
  • Jed Wing - The CHMLib Library
  • João Paulo Figueira [joao.figueira@vianw.pt] - General Help

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.

Sample screenshot

Sample screenshot

Extras

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.

Installation

Just copy the CHMReader.EXE & any CHM files to your PocketPC, and run.

Build Environment

To build the CHMReader, I used embedded Visual C V4 SP2.

History

  • V1.0 - 9 Feb 2004 - First release
  • V1.01 -11 Feb 2004 - Bug fixes - Incorrectly handling images which where not found in CHM file.
  • V1.03 - 18 Feb 2003 - Bug fixes - Pocket Internet Explorer does not handle script or XML tags, so I removed them from the HTML code before I pass it to the HTML code. Also links to other parts of the CHM file did not work correctly. Now fixed.
    • 24 Feb 2003 - Added download for PocketPC2002 OS

Extra Downloads

For the most current downloads, please download from here.

License

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


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Help Required Pin
Peter Tewkesbury8-Aug-07 23:35
professionalPeter Tewkesbury8-Aug-07 23:35 
GeneralHelp Required.. Pin
Sreekanth Muralidharan7-Dec-05 23:42
Sreekanth Muralidharan7-Dec-05 23:42 
GeneralRe: Help Required.. Pin
Peter Tewkesbury8-Dec-05 21:51
professionalPeter Tewkesbury8-Dec-05 21:51 
GeneralRe: Help Required.. Pin
Sreekanth Muralidharan11-Dec-05 16:59
Sreekanth Muralidharan11-Dec-05 16:59 
GeneralPerfect, mostly Pin
Mondor11-Sep-05 11:11
sussMondor11-Sep-05 11:11 
GeneralRe: Perfect, mostly Pin
Peter Tewkesbury18-Sep-05 21:57
professionalPeter Tewkesbury18-Sep-05 21:57 
QuestionCan it be tansplanted to wince.net? Pin
Member 215801223-Aug-05 23:43
Member 215801223-Aug-05 23:43 
AnswerRe: Can it be tansplanted to wince.net? Pin
Peter Tewkesbury25-Aug-05 3:02
professionalPeter Tewkesbury25-Aug-05 3:02 
Hi,

It is good to know that you like CHMReader.

There is a new version of CHMReader developed in .NET here http://www.codeproject.com/netcf/CHMReaderNet.asp[^]

I have looked into this before, and the main problem with WinCE is the difference between WinCE and PocketPE in terms of InternetExplorer and PocketIE. On PocketIE there is a shim which you can use to startup PocketIE and all is well. On WinCE, you normally get a full version of IE. Therefore you are expected to use COM to start IE. This is not possible under .NET (I no longer support this version of CHMReader & only develop CHMReader.NET)

However, in .NET CF V2.0 there will be a web browser control which will handle all cases, and I hope to update CHMReader, or its replacement when I can. My new version (being Tested) can handle HXS help files as well as CHM, it search all help files (Even if the help files do not have a search index), there is fast loading, and an ActiveSync pre-processing file filter when help files are copied to the PocketPC Device.




Peter Tewkesbury
Lead Developer
QuestionNeed help? Pin
RNick14-Aug-05 7:03
RNick14-Aug-05 7:03 
AnswerRe: Need help? Pin
Peter Tewkesbury14-Aug-05 21:27
professionalPeter Tewkesbury14-Aug-05 21:27 
GeneralSuggestion: fit-to-window feature Pin
John Hawk7-Aug-05 19:31
John Hawk7-Aug-05 19:31 
GeneralRe: Suggestion: fit-to-window feature Pin
Peter Tewkesbury8-Aug-05 21:48
professionalPeter Tewkesbury8-Aug-05 21:48 
GeneralRe: Suggestion: fit-to-window feature Pin
pinxue23-Feb-06 18:56
pinxue23-Feb-06 18:56 
GeneralTest Pin
AbdullahVB30-Jul-05 22:10
AbdullahVB30-Jul-05 22:10 
GeneralNothing to say! Just a great job! Pin
George Mamaladze16-Jun-05 11:40
George Mamaladze16-Jun-05 11:40 
GeneralGreat Tool Pin
Ghazi H. Wadi2-May-05 23:00
Ghazi H. Wadi2-May-05 23:00 
GeneralThanks Pin
zagwazatha16-Jun-05 6:57
zagwazatha16-Jun-05 6:57 
GeneralTrouble with cyrillic Pin
Member 183417627-Mar-05 22:42
Member 183417627-Mar-05 22:42 
GeneralRe: Trouble with cyrillic Pin
Peter Tewkesbury7-Apr-05 21:27
professionalPeter Tewkesbury7-Apr-05 21:27 
Generalimprove the performance dramatically Pin
pinxue9-Mar-05 18:43
pinxue9-Mar-05 18:43 
Generalcan't download Pin
mmtbb19-Nov-04 18:47
mmtbb19-Nov-04 18:47 
GeneralA wonderful tool! but a little flaw Pin
yizumi4-Sep-04 16:52
yizumi4-Sep-04 16:52 
GeneralRe: A wonderful tool! but a little flaw Pin
Peter Tewkesbury7-Apr-05 21:29
professionalPeter Tewkesbury7-Apr-05 21:29 
QuestionWhat about a PC version Pin
Member 11351561-Jun-04 19:29
Member 11351561-Jun-04 19:29 
AnswerRe: What about a PC version Pin
Peter Tewkesbury1-Jun-04 22:09
professionalPeter Tewkesbury1-Jun-04 22:09 

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.