4

I'm running my help file in this way:

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

but topicKeyword is a generic name of topic and in some cases this topic may not exist in help.chm file. I'd like to check first if this topic exists, otherwise the user will get chm-file but with error page/topic.

dtb
  • 213,145
  • 36
  • 401
  • 431
J.R.
  • 185
  • 1
  • 2
  • 10
  • 1
    The native api (HtmlHelp()) is primitive. Maybe the HH_KEYWORD_LOOKUP command. Doesn't help much, the user still doesn't have anything useful to look at. – Hans Passant Dec 06 '11 at 18:10

1 Answers1

0

You could use jedwing CHMLib to enumerate the topics in a CHM file. For example:

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;
}

Once you have enumerated the topics you could check a candidate url against your enumeration.

bradfordrg
  • 1,863
  • 2
  • 21
  • 34