Solved

Context sensitive help in MFC app

Posted on 2009-06-29
6
603 Views
Last Modified: 2013-12-14
Hello,

I'm developing an MFC application that I'd like to provide context sensitive help for. Does MFC provide such a facility? I think that .chm files are deprecated in Windows vista - something called MAML is used instead.

My questions is, what is the modern, preferred way to create context sensitive help within MFC?

Regards,
Sternocera
0
Comment
Question by:sternocera
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24742997
>>>> Does MFC provide such a facility?
Yes. If you create an MFC app by wizard, one of the default options you have is 'context sensitive help' switched on. It provides a menu entry in the help menu where the mouse cursor turns to an arrow with question mark upon top and where moving it to a control it could show help text if supplied by your application. It uses both the IDD of the dialog form and the IDC of the control to identify the text provided.

>>>> I think that .chm files are deprecated in Windows vista
Probably. Two points: Is your MFC app for Vista only? If yes you might consider changing to Windows Forms and .NET what surely has a more Vista like look-and-feel. Second, instead of chm you could switch to HTML help. There are a lot of tools which do both. Yoe easily can find them by googling for 'MFC help compiler HTML' or similar.
0
 

Author Comment

by:sternocera
ID: 24743333
>>>> If yes you might consider changing to Windows Forms and .NET what surely has a more Vista like look-and-feel.

My MFC app has a perfect Vista look and feel (All the more so because of the Visual studio 2008 extensions). Changing over to windows forms or .NET isn't practical anyway. I have a large MFC codebase here.

.chm *is* HTML Help.

Since I did not originally specify that context sensitive help should be used, how can I retrofit chm help into my application?

Regards,
Sternocera

0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 125 total points
ID: 24743528
>>>> Since I did not originally specify that context sensitive help should be used, how can I retrofit chm help into my application?
As told the context sensitive help generated by wizard is only a menu entry in the help menu. You may create two sample apps, one with context sensitive help on, one without and compare the generated code. It should be only the menu resource plus handler code.

The association between resource ids of dialog and controls with text are made by a batch command file mkhelp.bat (or similar). That would create a template for the help compiler out of your resource ids (afaik it is a .hm file it generates). To add more help you could write handlers for right-clicking on controls which would show some info text similar to a tooltip. That text was not provided from .chm but must be supplied by your prog.

>>>> .chm *is* HTML Help.
ok. But I am sure that there are other formats available as well. And probably it depends on the help compiler how the HTML help looks.

 
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:sternocera
ID: 24743591
itsmeandnobodyelse,

Thanks for that.

How can I actually invoke Html help from within MFC? I see that html workshop has a small C API bundled with it. I can spawn HTML help that way. However, I'd prefer to do so using CWnd::HtmlHelp. I cannot see to figure out what arguments I'm expected to supply to this function to get it to open a specific HTML help file.

Regards,
Sternocera
0
 
LVL 7

Assisted Solution

by:help-info
help-info earned 125 total points
ID: 24746956
May be you want to have a look at:
http://www.smountain.com/resource/CPPHTMLHelp.pdf
or see following link and search for "HTMLHelp - Programming"
http://www.help-info.de/en/Help_Info_HTMLHelp/hh.htm

Best regards
Ulrich Kulle
Microsoft MVP - Help
0
 

Author Comment

by:sternocera
ID: 24747380
I have succesfully called context sensitive help through CWnd::HtmlHelp. This is enough of a starting point for me. Plenty of current Apps use HTML help, so I'm happy enough to use it for the time being,

Thanks,
Sternocera
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question