How to check if a specific topic exists in a * .chm file?

I run the help file as follows:

Help.ShowHelp(null, @"help.chm", topicKeyword); 

but topicKeyword is the common name of the topic, and in some cases this question may not be in the help.chm file. First I want to check if this topic exists, otherwise the user will get a chm file, but with the page / subject of the error.

+4
source share
1 answer

You can use jedwing CHMLib to list topics in a CHM file. For instance:

 static int CallBack( struct chmFile *h, struct chmUnitInfo *pUI, void *context ) { printf( "%s\n", pUI->path ); return CHM_ENUMERATOR_CONTINUE; } int main() { chmFile *pFile = chm_open( "<Path to your CHM file>" ); if ( pFile ) { chm_enumerate( pFile, CHM_ENUMERATE_NORMAL, CallBack, 0 ); chm_close( pFile ); } return 0; } 

After listing the topics, you can check the candidate URL against your listing.

0
source

Source: https://habr.com/ru/post/1384935/


All Articles