CHM (htmlhelp) search for keyword

1.6k views Asked by At

I'm trying to interface the htmlhelp api (which is a big word for one function in two variants), and I have a problem with the following usecase:

Assume I have a simple programmer's editor, with a bunch of helpfiles (.CHMs). Some are from the core runtime library, some from more exotic libraries. Assume the CHMs are crafted normally, and their indexes contains all keywords I want to search. I want to be simply able to search through the various CHMs when a user presses F1 on a keyword in the editor

So roughly I want (in pseudo code):

firstchm
while not (out of CHMs) and not Found
   {
         if keyword in CHM then
           {
             found=true;
             break;
           }  
      nextchm;  
    }

I've played a bit with HH_HELP_TOPIC, but that would pop up a window for every attempted file, and worse it would be dog slow since the CHMs would not remain cached.

Is there really no solution except DIY with e.g. chmlib? Or is it worth making a study of merged CHM files first?

Language is Delphi or clone, but anything win32/COM and somewhat readable will do.

(edit) Search results for nested index entries might be the next problem: HTML Help keyword lookup (/edit)

update 2 After a long time, I got a potential hint elsewhere. Craft a CHM runtime that merges all the other CHMs. Windows will generate CHWs for it containing all the slave CHM's TOC and indexes. Requires Binary TOC=off and Binary Index=on though, for all slave CHMs, and a CHM compiler installed/available. But since that is CHM workshop default, that might be not too bad.

1

There are 1 answers

1
Yvo On

Do you want to create an index or do a one-time search for these keywords?

Couldn't you extract the HTML content from the CHM files with logical filenames, search the HTML content, and relate that back to the CHM file?