Solved

Context sensitive help in MFC app

Posted on 2009-06-29
6
592 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

778 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