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


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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 ..." );

      CDialog::OnSysCommand(nID, lParam);

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>>>> 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.
LearningCppAuthor Commented:
Experts Rock!!
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.