Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Context help

Posted on 1999-08-01
5
Medium Priority
?
427 Views
Last Modified: 2013-11-20
Could someone give me the steps required to get context help hooked up (where you've got a ? in title bar which you click on and then click on a control and a window pops up with the help in it). i have a dialog based application.
0
Comment
Question by:paulburns
[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
5 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1312243
I wouldn't mind some help in this area myself.  Just listening :-)
0
 
LVL 3

Expert Comment

by:VCGuru
ID: 1312244
In your app class add the message handler,
ON_COMMAND(ID_HELP, OnHelp)
like this
BEGIN_MESSAGE_MAP(CDiaApp, CWinApp)
      //{{AFX_MSG_MAP(CDiaApp)
            // NOTE - the ClassWizard will add and //remove mapping macros here.
            //    DO NOT EDIT what you see in these blocks of generated code!
      //}}AFX_MSG
      ON_COMMAND(ID_HELP, OnHelp)
END_MESSAGE_MAP()

in your .h file of your app add
afx_msg void OnHelp();

in your .cpp file
CMyApp::OnHelp()
{
WinHelp(...);
}
you can see the documentation for WinHelp to open the right section of your help file. You could use the win32 API function(::WinHelp(..)) too.
0
 
LVL 2

Author Comment

by:paulburns
ID: 1312245
Sorry, this is useless. All you've described is standard F1 help. I need _context_ help (pop-up windows like tooltips) for individual controls in a dialog.
0
 
LVL 1

Accepted Solution

by:
jclanz earned 400 total points
ID: 1312246
Hello,

Modify the style in OnInitDialog() to add the '?' button.

BOOL CMyDialog::OnInitDialog()
{
  CDialog::OnInitDialog();
  ModifyStyleEx(0, WS_EX_CONTEXTHELP);
  ...
  return TRUE;
}

Add a message handler for the WM_HELP.

BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
  //{{AFX_MSG_MAP(CMyDialog)
  ON_MESSAGE(WM_HELP, OnCommandHelp)
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()

LRESULT CDlgHelpDlg::OnCommandHelp(WPARAM wParam, LPARAM lParam)
{
  HELPINFO* pHelpInfo = (HELPINFO*)lParam;
  int nID = pHelpInfo->iCtrlId;
  switch (nID)
  {
    case IDOK: break;
    case IDCANCEL: break;
    case ID_HELP: break;
    default:
      nID += 0x2000; // for IDC_ controls to HIDC_
  }
  AfxGetApp()->WinHelp(nID, HELP_CONTEXTPOPUP);
  return 0;
}

you can add these lines in the MakeHelp.bat file for IDC_ controls.

echo. >>"hlp\DlgHelp.hm"
echo // Controls (IDC_*) >>"hlp\DlgHelp.hm"
makehm IDC_,HIDC_,0x20000 resource.h >>"hlp\DlgHelp.hm"

regards, jean-claude.

0
 
LVL 2

Author Comment

by:paulburns
ID: 1312247
sorry about the delay, been sidetracked with other things. i finally got around to implementing your suggestion and it works perfectly. thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

704 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