Hosting help content online

Viewed 92

I'm trying to package some of my MFC applications as Windows 10 apps using Desktop Bridge.

I am having no end of trouble getting my HTML help file (CHM) included and working with the installed program (new versions of VS don't include the help file, and using workaround to include that file results in a file that I don't have the rights to access).

So it makes me wonder about hosting the online help on my website. A couple of the issues that arise is how best to host multiple help topics, and how to override (on a application-wide basis) the behavior of accessing help topics. (My app is dialog-based.)

So I just wondered if anyone else has done this already. I'd be curious to review how these issues were addressed. I was not able to find anything online.

1 Answers

I do host my html help in a single document, using html anchors to get to the topic of interest. If you have multiple pages, adapt MyHelp accordingly.

I didn't actually use the Desktop Bridge but wondered if you have tried something like this:

BOOL CMyDialog::OnHelpInfo(HELPINFO* pHelpInfo) 
{
    MyHelp(_T("HIDD_MYDIALOG"));            // HTML anchor goes here
    return CDialog::OnHelpInfo(pHelpInfo);
}

...

// a global helper function for showing help
void MyHelp(LPCTSTR anchor)
{
    extern CMyApp theApp;
    TCHAR *cp, buffer[1000];

    // look for the html document in the program directory
    strcpy(buffer, _T("file:///"));
    DWORD dw = GetModuleFileName(theApp.m_hInstance, buffer + strlen(buffer), sizeof(buffer));

    if (cp = strrchr(buffer, '\\'))
    {
        strcpy(cp+1, _T("MyHelpDocument.htm#"));
        strcat(cp+1, anchor);

        // for some reason, I don't want the default browser to open, just the Internet Explorer
        ShellExecute(NULL, _T("open"), _T("iexplore"), buffer, NULL, SW_SHOWNORMAL);
            // or, for real online help, use just '_T("http://myurl.com/myonlinehelpdocument.html#") + anchor'
            // instead of 'buffer' and ommit all before ShellExecute()
    }
}

I'm not sure if ShellExecute will behave the way it used to in the shop app though. But certainly there will be a way to open a URL somehow. You might want to try if the Internet Explorer ActiveX works to display your help pages inside the app.

Related