?
Solved

How can i catch the help button "?" message in a MFC dialog

Posted on 2008-11-06
4
Medium Priority
?
653 Views
Last Modified: 2013-11-20
Hi,

After googling all day, I thought i would post it here.
I have a MFC application in which i want to integrate a compiled help file.
with few links i could do it.
however on a CDialog-derived dialog, when I add Context help i am able to see "?" in the title.
when i click on ?, the cursor will have a ? and only when i click on a control my OnHelpInfo function is called.
What i want is:- when user clicks ont the "?" button, I want to directly open the chm file.

I cant seem to find a function where i can call htmlhelp.
I have tried OnHelp() but that will only be called when F1 is pressed, but not when ? is clicked.

Can anyone tell me how can i do this?
0
Comment
Question by:LearningCpp
4 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 2000 total points
ID: 22904705
Hi LearningCpp,

just add a WM_SYSCOMMAND message handler in the dialog - implement it like this:

void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
      if ( nID == SC_CONTEXTHELP )
      {
            AfxMessageBox( "Show help here ..." );
            return;
      }

      CDialog::OnSysCommand(nID, lParam);
}


Hope that helps,

ZOPPO
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22906249
>>>> only be called when F1 is pressed, but not when ? is clicked.
The ? minibutton is a context help which was supposed to give help for an item like an edit field or list control where the user clicked on using the ? cursor.

You could integrate the normal help into a help menu by adding a menu item with the ID_HELP id. You also could add a new minibutton for the standard help by enhancing the toolbar buttons in CMainFrame class. Check the mainframe.cpp for that.
0
 

Author Comment

by:LearningCpp
ID: 22907284
Zoppo,
perfect....
Experts Rock!!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 22908263
I concur  with itsme... The [?] button is a U/I device that has a specific purpose:  context-sensitive help for individual U/I elements on a form.   I'd never use it as a way to get general help, any more than I'd change the meaning the the [x] button to mean "delete the last thing I typed" or "turn the window green."   One should not confuse the user by making novel use of system-defined U/I elements.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

750 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