鼠标放在控件上显示提示信息

1.在对话框类中添加成员变量:

CToolTipCtrl m_hTtc;

2.在OnInitDialog()添加如下代码:

EnableToolTips(TRUE);
m_hTtc.Create(this);
m_hTtc.Activate(TRUE);
m_hTtc.AddTool(FromHandle(m_hLoadBmp.m_hWnd),"从文件夹中选择一张图片");
m_hTtc.AddTool(FromHandle(m_hLoadExcel.m_hWnd),"从文件夹中选择一个表格");

3.重载PreTranslateMessage

//头文件

BOOL PreTranslateMessage(MSG* pMsg);

//源文件

BOOL CxxxxxDlg::PreTranslateMessage(MSG* pMsg)
{
 m_hTtc.RelayEvent(pMsg);
 return CDialog::PreTranslateMessage(pMsg);
} 

 

你可能感兴趣的:(提示信息)