C Programming Column
by Al Stevens

Example 1:
class CPage : public CPropertyPage  {
// ...
    virtual void OnHelp();
    DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CPage, CPropertyPage)
    ON_COMMAND(ID_HELP, OnHelp)
    // ...
END_MESSAGE_MAP()
void CPage::OnHelp()
{
    theApp.WinHelp(CPage::IDD + 0x20000, HELP_CONTEXT);
}

Example 2:
class CPage : public CPropertyPage  {
// ...
    virtual BOOL OnHelpInfo(HELPINFO* pHelpInfo);
    DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CPage, CPropertyPage)
    ON_WM_HELPINFO()
    // ...
END_MESSAGE_MAP()

BOOL CPage::OnHelpInfo(HELPINFO* pHelpInfo) 
{
    if (pHelpInfo->iContextType == HELPINFO_WINDOW) {
        int nID = ::GetDlgCtrlID((HWND)(pHelpInfo->hItemHandle));
        theApp.WinHelp(nID + 0x10000, HELP_CONTEXT);
        return TRUE;
    }
    return CPropertyPage::OnHelpInfo(pHelpInfo);
}

Example 3: 
// WINBUG: Windows currently does not support DIALOGEX resources!
// remove the following:
//  2. Help IDs on any control in the dialog

Example 4:
echo // Dialog Controls (IDC_*) >>"hlp\project.hm"
makehm IDC_,HIDC_,0x10000 resource.h >>"hlp\project.hm"
echo. >>"hlp\project.hm"


Listing One
class CPage : public CPropertyPage  {
// ...
    BOOL OnToolTipNotify(UINT, NMHDR* pNMHDR, LRESULT*);
    DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CPage, CPropertyPage)
    ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
    // ...

END_MESSAGE_MAP()

BOOL CPage::OnToolTipNotify(UINT, NMHDR* pNMHDR, LRESULT*)
{
    TOOLTIPTEXT* pTTT = (TOOLTIPTEXT*)pNMHDR;
    if (pTTT->uFlags & TTF_IDISHWND)    {
        UINT nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
        pTTT->hinst = AfxGetResourceHandle();
        switch (nID)  {
            case IDC_EDIT1:
                pTTT->lpszText = "An editor";
                return(TRUE);
            case IDC_TOGGLEEXIT:
                pTTT->lpszText = m_pCSheet->IsExitEnabled() ? 
                           "Disable exit" : "Enable exit";
                return(TRUE);
            default:
                pTTT->lpszText = "";
                break;
        }
    }
    return(FALSE);
}


1



