Search code examples
chmhtml-helphelpndoc

Linking to specific topics in HelpnDoc compiled CHM using Visual C++ HtmlHelp


I am confused here. I have migrated my CHM help from HtmlHelp Workshop to HelpNDoc. I compiled the CHM file and updated my MFC project to direct to the correct topic:

HtmlHelp((DWORD_PTR)_T("msa-options-publishers-db.html"), HH_DISPLAY_TOPIC);

The above approach worked with my previous CHM file. When I invoke this call the following happens:

CHM

It doesn't find it. Now I am having difficulties here because if I click F1 in my IDE (VS2017) it takes me to here. This article provides an example for showing a topic:

HWND hwnd =
   HtmlHelp(
            GetDesktopWindow(),
            "c:\\Help.chm::/Intro.htm>Mainwin",
            HH_DISPLAY_TOPIC,
            NULL) ;

The above HtmlHelp API call is taking 4 parameters. Yet, in my CDialogEx derived class I only have two parameters:

HtmlHelp

So I need to find a way that will work to open any topic in my CHM file as compiled with HelpNDoc.

Update

On further research I located the topic that discusses the HtmlHelp API call that I am using (found in the CWinApp class). It states:

Parameters

dwData Specifies additional data. The value used depends on the value of the nCmd parameter.

nCmd Specifies the type of help requested. For a list of possible values and how they affect the dwData parameter, see the uCommand parameter described in About the HTMLHelp API Function in the Windows SDK.

So we end up here where we are given a link to details about HH_DISPLAY_TOPIC. We have gone full circle. Looking closely it states:

Specifies a compiled help (.chm) file, or a specific topic within a compiled help file.

To specify a defined window type, insert a greater-than (>) character followed by the name of the window type.

So my code should still be fine.


Solution

  • You won't believe how simple the resolution to this issue was!

    I did a test with HTML Help Workship API window:

    Test

    The only one that worked was when I used htm as the suffix and not html. See:

    Results