How can I add a context sensitive help button for a specific dialog control

647 Views Asked by At

I have an MFC app (10 year old app), which has context sensitive help for each dialog. I want to add help on a specific combobox, as well as a little question mark button next to this control. Users can either select the combobox and hit F1, or they can click on the button next to the combobox, and it will jump to a help page that is specifically about this combobox, rather than general help for the whole dialog.

  • In the dialog resource properties, I have set "Context Help" to True.
  • In the combobox properties, I've set "Help ID" to True.
  • In myapp.hpp, I have added "HIDC_MYCOMBOBOX = mycombobox_help.htm" to the [ALIAS] section, and included the resource.hm file in the [MAP] section.
  • Again in app.hpp file, the dialog uses "HIDD_MYDIALOG = mydialog_help.htm"

Yet selecting the combobox and pressing F1 still brings up mydialog_help.htm, instead of mycombobox.htm.

  1. What am I missing to use a separate help page for the control?
  2. Is it possible to redirect the control to an anchor in the main page? Something, along the lines of... HIDC_MYCOMBOBOX = mydialog_help.htm#mycombobox
  3. I have added a "?" button to run the following code, but this also doesn't give the context for the control, and just opens the mydialog_help.htm.

    HELPINFO    lhelpinfo;
    
    lhelpinfo.cbSize = sizeof(lhelpinfo);
    lhelpinfo.iContextType = HELPINFO_WINDOW;
    lhelpinfo.iCtrlId = IDC_BALANCING_METHOD;
    lhelpinfo.hItemHandle = GetDlgItem(IDC_BALANCING_METHOD)->m_hWnd;
    lhelpinfo.dwContextId = HIDC_BALANCING_METHOD;
    lhelpinfo.MousePos = POINT();
    
    CDialog::OnHelpInfo(&lhelpinfo);
    
0

There are 0 best solutions below