views:

116

answers:

2

I have a number of CHM files, and each of the files is a comressed html for 5 different Html files. I mean, lets say I have 5 different files named Alpha, Beta, Gamma, Delta, Theta. Say, I compress these 5 in a CHM file. Lets call that file CompressedHtm.CHM. I have >500 of these files. Now I want to check if all of these >500 files have all 5 subfiles( i.e. Alpha, Beta, Gamma, Delta, Theta). Is there a way to check that in VC++ 6.0 /MFC without decomiling the CHM files.?

A: 

HTML Help uses IE for display. So you just need to use a webbrowser to navigate to a URL like mk:@MSITStore:c:\WINDOWS\Help\htmlhelp.chm::/apiref.htm. If the file does not exist, you will get DWebBrowserEvents2::NavigateError with a 404 status code. Note you may get other errors on modern versions of Windows as Microsoft has limited its usage due to security concerns.

Sheng Jiang 蒋晟
+1  A: 

With Free Pascal comes a totally standalone(*) command line executable CHMLS that allows to list the contents of a CHM file. It exists for multiple platforms.

You could execute that using pipes and then process the output.

I happen to zip the exes for sb else a few days back, you can get them here http://www.stack.nl/~marcov/chmls.zip

(or download the fpc 2.4.0 windows release if you don't trust me)

(*) I don't know the state on win9x.

The output looks like:

 <Section> <Offset> <UnCompSize>  <Name>
 0               0            0  /#ITBITS
 1        27737212       192334  /#STRINGS
 0              70          133  /#SYSTEM
 1        22414493       169080  /#TOCIDX
 1        26847375       339904  /#TOPICS
 1        27187279       294757  /#URLSTR
 1        27482036       255176  /#URLTBL
 1        27929546      1174749  /$FIftiMain
 1        22411742         2751  /$OBJINST
 0               0            0  /$WWKeywordLinks/
 1        24122411       628812  /$WWKeywordLinks/BTree
 1        24751223       111371  /$WWKeywordLinks/Data
 1        24862594         2378  /$WWKeywordLinks/Map
 1        24864972            1  /$WWKeywordLinks/Property
 0               0           70  /_#_README_#_
 0               0            0  /baseunix/
 1        10656150         1395  /baseunix/_stat_ver.html
 1        10651853         1438  /baseunix/_stat_ver_kernel.html
 1        10654717         1433  /baseunix/_stat_ver_linux.html
 1        10650407         1446  /baseunix/_stat_ver_linux_old.html
 1        10653291         1426  /baseunix/_stat_ver_svr4.html
 1        10452426         1438  /baseunix/arg_max.html
 1        10644473         1510  /baseunix/bitsinword.html

The files starting with # and $ are internal files.

(the tools are utils that come with Free Pascal's CHM library which supports CHM read/write support independant of other tools for Free Pascals documentation and help systems. It's OS independant, and to my best knowledge it works fine on OS X/PowerPC64

Marco van de Voort