Solved

Context sensitive help in MFC app

Posted on 2009-06-29
6
617 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft C++ code failing in executable that worked 9 138
Which Linux flavors will this run on? 6 113
Adding items to a C# list incrementally 5 82
Need some help with design 17 46
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

734 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