MFC Quick Start Guide (Part 6): ToolTip
- Add a member variable in MFC101Dlg.h
CToolTipCtrl m_ToolTip;
- Add a member function:
virtual BOOL PreTranslateMessage(MSG* pMsg);
- Inside MFC101Dlg.cpp, add the function code:
BOOL CMFC101Dlg::PreTranslateMessage(MSG* pMsg) { m_ToolTip.RelayEvent(pMsg); return CDialog::PreTranslateLessaage(pMsg); }
- Go back to OnInitDialog(), and initialize the tooltip:
if (!m_ToolTip.Create(this)) { TRACE("Unable to create the ToolTip!"); } else { m_ToolTip.AddTool((CButton *) GetDlgItem (IDC_BUTTON1); _T("Adjust the three bars to control th text background color.")); m_ToolTip.Activate(TRUE); }
Build & Run
MFC Quick Start Guide (Part 6): ToolTip
Reviewed by Kevin Lai
on
12:43:00 AM
Rating:

No comments: