CButton *pButton;
pButton=(CButton *)GetDlgItem(IDC_BUTTON1);
m_ToolTips.Create(this);
m_ToolTips.AddTool(pButton,"This is a ToolTips text for this Button");
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
switch(pMsg->message)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
m_ToolTips.RelayEvent(pMsg);
}
return CDialog::PreTranslateMessage(pMsg);
}
project->add to project->component and controls->Visual C++ Components->
ToolTip Support
插入后, 将OnInitDialog中的
m_tooltip.AddTool(GetDlgItem(IDC_<name>), "<text>");
改为
m_tooltip.AddTool(GetDlgItem(IDOK), "确定");