8
我在Visual C++中有一個窗口應用程序(win32 API),其中我必須將控件按鈕添加工具提示。任何人都可以幫助我完成上述任務嗎?提前致謝。如何使用Visual C++ 2008添加工具提示來控制窗口應用程序(win32 API)
我在Visual C++中有一個窗口應用程序(win32 API),其中我必須將控件按鈕添加工具提示。任何人都可以幫助我完成上述任務嗎?提前致謝。如何使用Visual C++ 2008添加工具提示來控制窗口應用程序(win32 API)
如果不使用MFC類使用CToolTipCtrl
類的例子看About Tooltip Controls
這裏,
// Init a tooltip window
m_ToolTipCtrl = new CToolTipCtrl;
m_ToolTipCtrl->Create(this); // 'this', usually a CDialog window
m_ToolTipCtrl->SetMaxTipWidth(300); // if you need multiline messages
m_ToolTipCtrl->SetTipBkColor(0x000000);
m_ToolTipCtrl->SetTipTextColor(0xe0e0d0);
// Attach a CListBox control (we can attach many controls)
m_ToolTipCtrl->AddTool(plstBox, "Hey, i am a tooltip message!");
// ...
// (*) We must use the following in order to use tooltips (MFC 4.0 and later versions)
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{
if (NULL != m_ToolTipCtrl)
m_ToolTipCtrl->RelayEvent(pMsg); // <- listen mouse messages!
return CDialog::PreTranslateMessage(pMsg);
}
我不使用MFC,但你鏈接緩解我的問題,謝謝你的回覆。 – 2009-12-02 13:42:56
你使用MFC? – 2009-12-02 11:20:35