首先在头文件里定义
CToolTipCtrl m_tooTip;
CWnd *pw;
在源文件里的OnInitDialog里加入
EnableToolTips(true);
m_tooTip.Create(this);
m_tooTip.Activate(true);
m_tooTip.SetDelayTime(10);
m_tooTip.SetDelayTime(TTDT_AUTOPOP,3000);
pw = GetDlgItem(IDC_BUTTON_LISTEN);
BOOL CWin32ServerDlg::PreTranslateMessage(MSG* pMsg)
{
m_tooTip.RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}
m_tooTip.AddTool(pw,tmpstr);