This isn't supposed to be a proper program - it's supposed to demonstrate the bare minimum you need to replicate the functionality of HTML Help Workshop's hhc.exe.
hhc.exe is great for generating CHM (which no-one speaks) files from HTML (which everyone speaks). However, if you want to use it dynamically (i.e. not provide CHMs with your binaries), it's a bit confusing.
- HHW's license specifies you should only include the redistributable.
- You have to install HHW either way...
- You need an out of process call to build the CHM
This rather useful resource page from the Helpware Group gives two really interesting bits of information.
If we look at the exports from HHA.DLL, we see that it exports HHA_CompileHHP...
- HHC uses HHA.DLL
From win2k onwards, HHA.DLL comes with your windows installation.Alas, not quite correct, I probably misinterpreted the helpware page... :( . You can get HHA easily, but it doesn't seem to come with vanilla windows. More anon.
This has the following prototype (inferred....)
typedef int (WINAPI *HHACOMPTYPE)(LPCSTR, HHACALLBACK, HHACALLBACK, HHAData *);
Where HHACALLBACK is
typedef int (WINAPI *HHACALLBACK)(LPCSTR);
The two callbacks you have to provide are used to provide running status information (for status bars etc), and to provide useful output.
The HHAData parameter provides detailled return output from the Help Compiler - you can pass in null if you're not interested in this (or if you don't trust the odd looking struct I've thrown together! ;) - the struct I use (HHAData) is inferred from several dumps of HTML help compilation, and seems to work rather well... *g*
And... that's pretty much it. There's some useful output that comes back from the callbacks, and the below program, entertainingly, pretty much performs the same functionality as HHC.EXE. And you don't need to either call out, or install HTML HELP Workshop - just aggregate this functionality!
sample help source to test against.
(it's beyond the scope of this page to explain how to build HHC source documents - read the HTML HELP workshop docs)
- COM is required - don't forget to CoInitialise
- Oddly, the compression stage of compilation FAILS if you use COINIT_MULTITHREADED
- Compile with multi-byte
Update: I see Flier Lu got there earlier [page in Chinese] :( .... This version does add the interpretation of the HHAData param tho ;)
Update #2: Bah. It seems that HHA.DLL doesn't necessarily come with your installation. Seems to be fairly easy to get hold of, but I'm sure the joy of licensing rears its head. Might dig into this a bit.....
| || Last updated 05/2008 |