Search code examples
visual-c++mfcdesktop-application

How can I create Help Documentation for my MFC desktop application?


I am creating an MFC desktop application with Visual Studio 2022 Community edition. I want to include with it some user Help documentation that will be installed with the application (i.e. should be installed locally on user computer and not accessed via the internet).

BUT I cannot see anywhere how to do this or find any tools for creating such help documentation.

Even for help documentation that is accessed via an internet connection I cannot immediately see any tools or utilities with Visual Studio that make this possible? Are there any third party applications that allow an application developer to create help documentation? Thanks to anyone who can advise.


Solution

  • I use HelpNDoc. With the free edition you can easily build your help documentation in CHM and HTML.

    And, for either of these outputs it is quite easy to get the MFC project to display the topic. For example:

    void CMeetingScheduleAssistantApp::DisplayHelpTopic(CString strTopic)
    {
        CString strURL = _T("https://help-msa.publictalksoftware.co.uk/") + strTopic;
    
        if (theApp.UseDownloadedHelpDocumentation())
        {
            // CHM files use 3 letter suffix
            strTopic.Replace(_T(".html"), _T(".htm"));
            HtmlHelp(ptr_cast<DWORD_PTR>(strTopic.GetString()), HH_DISPLAY_TOPIC);
        }
        else
            ShellExecute(nullptr, nullptr, strURL, nullptr, nullptr, SW_SHOWDEFAULT);
    }
    

    In your case I would compile as CHM as that can be installed on the target computer. But you could also build PDF, DOCX and / or other formats.


    There are other applications that build CHM files (like HTML Help Workshop) but it is less fiddly with HelpNDoc as all help data is managed in one place.