Menu

Help files (*.chm et al)

Help
2014-09-23
2014-10-09
  • Robert Tausworthe

    I can find no provisions in Win32++ to accommodate linking an application to a compiled html (.chm) help file (or other form of help file) for context sensitive help, as has MFC. Am I missing something? If not, is this a planned extension to Win32++?

     
  • David

    David - 2014-09-25

    Hi Bob

    The function you are looking for is HtmlHelp. It is provided by the Windows API.

    HtmlHelp allows the programmer to specify the CHM file, and optionally the topic within the CHM file.

    You will find some information on using HtmlHelp in the documentation that ships with MS Windows SDK. This can be downloaded from http://www.microsoft.com/en-au/download/details.aspx?id=8279

    This example is from the documentation:

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

    Best regards,
    David

     
  • Robert Tausworthe

    Yes, I am aware of help file provisions in the SDK, but had hoped to find more of an MFC-like interface in your CWinApp. In this case it is not a burden to use the SDK. Do you plan eventually to include more of the MFC features into CWinApp?

     
  • David

    David - 2014-10-03

    Hi Bob,

    I hadn't planned on wrapping HtmlHelp at this stage, as I'm not sure if this adds much value. Not ruling it out though.

    Cheers,
    David

     
  • Robert Tausworthe

    There's good news and bad news. The bad news is that GetDesktopWindow() in the above doesn't work, producing the message:

    [Error] cannot convert 'Win32xx::CWnd' to 'HWND' for argument '1' to 'HWND__ HtmlHelpA(HWND, LPCSTR, UINT, DWORD_PTR)'

    Changing GetDesktopWindow() to HWND() and casting the NULL to DWORD_PTR does allow the code to be compiled without error.

    The second item of bad news is that MinGW must have a bug, because after compilation, it complains that there is an undefined reference to HtmlHelpA@16. So this avenue for help files is not supported.

    The good news is that there is no need for you to include the HtmlHelp wrapping in CWinApp, because it wouldn't work anyway.

    So I am using, instead,

    ::ShellExecute(HWND(), _T("open"), GetTheApp()->m_sHelpFilePath, NULL, NULL, SW_SHOWNORMAL )

    which calls the help file successfully, but without context help.

    FYI,
    Bob

     
  • Robert Tausworthe

    Since my post above, I was able to download the lhtmlhelp.a file from MSDN into my MinGW chain and link my app to it, so now HtmlHelp is now operative. Startup glitches &*!@#&$.

     

Log in to post a comment.