Date: 2008sep8
Framework: MFC
Language: C/C++
Q. MFC: How do I add tooltips to a regular button?
A. Use the CToolTipCtrl class. For button in a toolbar there is a
different way.
Add this to your dialog:
CToolTipCtrl m_ButtonToolTip;
In InitDialog() do:
m_ButtonToolTip.Create(this);
m_ButtonToolTip.AddTool(&m_OK, "OK. Save your updates.");
m_ButtonToolTip.Activate(TRUE);
Handle PreTranslateMessage this way:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
m_ButtonToolTip.RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}