Tooltips not shown in dll's modeless dialog
Environment: VC++ .NET 2005, Windows XP + SP2
I am developing an application that contains a modeless dialog.
I want to have tooltips at the buttons in the dialog.
The main code is as followings:
{
m_oToolTipCtrl.Create(this, TTS_ALWAYSTIP);
m_oToolTipCtrl.Activate(TRUE);
m_oToolTipCtrl.AddTool(FromHandle(m_oMyBtn.GetSafeHwnd()),
_T("MyTooltips"));
}
and EnableToolTips in the OnInitDialog().
1, On usual way, I call m_oToolTipCtrl.RelayEvent(pMsg) in
PreTranslateMessage(MSG* pMsg).
But PreTranslateMessage() in thedialog doesn't get called,
2, So in another way, I make a WM_MOUSEMOVE message to call
RelayEvent()
void CMyDialog::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MSG msg;
msg.hwnd = this->GetSafeHwnd();
msg.message = WM_MOUSEMOVE;
msg.wParam = WPARAM(nFlags);
msg.time = 0;
msg.pt.x = point.x;
msg.pt.y = point.y;
msg.lParam = MAKELPARAM(LOWORD(point.x), LOWORD(point.y));
m_oToolTipCtrl.Activate(TRUE);
m_oToolTipCtrl.RelayEvent(&msg);
}
Now I can call the RelayEvent, however, the result is that the
tooltips never shows.
I hope someone could give some clarity of the problem.
Regards, and thanks in advance,