Annoying problem with F1 help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Annoying problem with F1 help

  1. #1
    Join Date
    May 2002
    Posts
    1,719

    Annoying problem with F1 help

    Having built an application with Context Sensitive Help, and having added and edited the help (*.htm) files with M$ Expression Web 3, and further setting up Contents and Index files using M$ HTML Help Workshop (version 4.75, Jan 12 1999), I discovered that I can summon the *.chm help file using a method such as (assuming I have added #include <htmlhelp.h> and linked the associate htmlhelp.lib):
    Code:
    void CMyDlg::ViewHelp()
    {
    	::HtmlHelp(NULL, _T("MyApp.chm::/FAQs.htm"), HH_DISPLAY_TOPIC, 0);
    	
    }// ViewHelp()
    However, F1 will not summon the help file (as it did in the past), instead I receive the message:
    HH_HELP_CONTEXT called without a [MAP] section.
    Further, if the application is installed using and msi file, the desktop shortcut that is rigged to call ViewHelp doesnt work at all ! ( No message, no error, no natha).

    Now there is a great deal of web chatter about the failure of F1 help with Win 7 OS (which is what I'm using to build and test deploy). This is apparently something of a 'security issue' (isn't everything), so that one of the M$ updates made it this way.

    For a nauseating lengthy discussion of the problem (as if this one wasn't), see

    http://www.grainge.org/pages/authori...m#about_896358

    My question (lest I forget) is whether or not it is advisable to forget built-in Context Sensitive Help altogether and simply post application specific help on an Internet server.

    What are you guys doing ?
    mpliam

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,933

    Re: Annoying problem with F1 help

    Please try and see if the sample works in Win7.
    Attached Files Attached Files
    Best regards,
    Igor

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,933

    Re: Annoying problem with F1 help

    Quote Originally Posted by Mike Pliam View Post
    Code:
    void CMyDlg::ViewHelp()
    {
    	::HtmlHelp(NULL, _T("MyApp.chm::/FAQs.htm"), HH_DISPLAY_TOPIC, 0);
    	
    }// ViewHelp()
    Further, if the application is installed using and msi file, the desktop shortcut that is rigged to call ViewHelp doesnt work at all ! ( No message, no error, no natha).
    Very probable that the issue is related to using relative path to CHM file, which appears different in case of installing shortcuts or something like that. To test this I would recommend to construct fully qualified path to your help file and see if this helps.
    Best regards,
    Igor

  4. #4
    Join Date
    May 2002
    Posts
    1,719

    Re: Annoying problem with F1 help

    Igor - your demo works when installed in Win 7 (Ultimate) Program Files (x86) / My Company/ - both with the OK button and with F1. BTW, your method of using make.bat files is very clever. It took me awhile to figure out how to run it (I'd forgotten to use the command line prompt). I wish I knew how to write the scripts - I'm afraid it's a programming skill I have yet to develop.

    Victor, your suggestion to provide a fully qualified path fixed the problem of the installed (Program Files (x86)...) worked as well.

    Code:
    	wchar_t szHelpPath[MAX_PATH];
    	GetModuleFileName(NULL, szHelpPath, MAX_PATH);
    	PathRemoveFileSpec(szHelpPath);
    	wcscat_s(szHelpPath, MAX_PATH, _T("\\MyApp.chm"));
    	TRACE0("ViewHelp : szHelpPath =: "); OutputDebugString(szHelpPath); TRACE0("\n");
    
    	//::HtmlHelp(NULL, _T("MyApp.chm::/Introduction.htm"), HH_DISPLAY_TOPIC, 0);
    	::HtmlHelp(NULL, szHelpPath, HH_DISPLAY_TOPIC, 0);
    However I could not figure out how to call a specific topic using this code as it doesn't work at all if one tries the commented out line.
    Last edited by Mike Pliam; February 13th, 2013 at 02:34 PM.
    mpliam

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,933

    Re: Annoying problem with F1 help

    Quote Originally Posted by Mike Pliam View Post
    Igor - your demo works when installed in Win 7 (Ultimate) Program Files (x86) / My Company/ - both with the OK button and with F1...
    ... that makes me think that your help file must be most probably ill formed: "HH_HELP_CONTEXT called without a [MAP] section." Could you modify my sample to call your CHM article?

    However I could not figure out how to call a specific topic using this code as it doesn't work at all if one tries the commented out line.
    You should take some more intent look at my demo where I just combine help path with the article specification:
    Code:
    // szHelp is CString
    
    	void OnMyHelp()
    	{
    		if(!::HtmlHelp(NULL, szHelp + TEXT("::/a3.htm"), HH_DISPLAY_TOPIC, 0))
    			AfxMessageBox(TEXT("Failed"));
    	}
    Best regards,
    Igor

  6. #6
    Join Date
    May 2002
    Posts
    1,719

    Re: Annoying problem with F1 help

    Igor, I don't see much difference between your OnMyHelp code and this one - which doesnt work (note that I cannot use '+' to concatenate strings in my code).

    Code:
    	wcscat_s(szHelpPath, MAX_PATH, _T("\\UeberKrypt.chm::/Introduction.htm"));
    As far as my chm file be ill-formed, that is quite likely. Normally Visual Studio 2010 will construct a 'well-formed' chm file with a myriad of default htm pages. I find that most or all of those default pages are not helpful for my users and so I tend to remove them (in the case of SDI or MDI with Context Sensitive Help, not necessary with a Dialog app). In any case, as I mentioned, I generally add htm pages using M$ Expression Web 3 and edit and compile the Contents and Index components with M$ HTML Workshop (a very old program). But if i don't do that, if I just let VS build the help files, no content or index components are added. NOW THERE IS SOMETHING VERY CLEARLY THAT I DON'T UNDERSTAND ABOUT HOW ONE IS SUPPOSED TO BUILD MODERN (VS 2010 +) CHM FILES WITH ALL THE NECESSARY GADGETS. VS doesn't make this easy.
    mpliam

  7. #7
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,933

    Re: Annoying problem with F1 help

    Quote Originally Posted by Mike Pliam View Post
    Igor, I don't see much difference between your OnMyHelp code and this one - which doesnt work (note that I cannot use '+' to concatenate strings in my code).

    Code:
    	wcscat_s(szHelpPath, MAX_PATH, _T("\\UeberKrypt.chm::/Introduction.htm"));
    But this does differ from what you posted above

    In any case, as I mentioned, I generally add htm pages using M$ Expression Web 3 and edit and compile the Contents and Index components with M$ HTML Workshop (a very old program). But if i don't do that, if I just let VS build the help files, no content or index components are added. NOW THERE IS SOMETHING VERY CLEARLY THAT I DON'T UNDERSTAND ABOUT HOW ONE IS SUPPOSED TO BUILD MODERN (VS 2010 +) CHM FILES WITH ALL THE NECESSARY GADGETS. VS doesn't make this easy.
    Sorry, can't help you with that, as my very last case with building somewhat rich help file was done with old good WinHelp.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center