15,979
社区成员
发帖
与我相关
我的任务
分享
m_tt.Create(this);
m_tt.Activate(TRUE);
m_tt.AddTool( this,"Tip Text!");
m_tt.SetDelayTime(TTDT_INITIAL,1 );
m_tt.SetDelayTime(TTDT_AUTOPOP,1000);
BOOL C***Dlg::PreTranslateMessage(MSG* pMsg)
{
CRect rtWnd,rtTitle;
GetWindowRect(&rtWnd); //取得窗口的屏幕坐标
CPoint offpt;
offpt.x = rtWnd.left+GetSystemMetrics( SM_CXFRAME );
offpt.y = rtWnd.top +GetSystemMetrics( SM_CYFRAME );
rtTitle.left = GetSystemMetrics( SM_CXFRAME );
rtTitle.top = GetSystemMetrics( SM_CYFRAME );
rtTitle.right = rtWnd.right - rtWnd.left - GetSystemMetrics(SM_CXFRAME);
rtTitle.bottom = rtTitle.top + GetSystemMetrics(SM_CYSIZE);
rtTitle.OffsetRect( offpt ); //取得标题栏的屏幕坐标
CPoint pt; ::GetCursorPos( &pt ); //取得鼠标的屏幕坐标
if( pMsg->message == WM_NCMOUSEMOVE && rtTitle.PtInRect( pt ) )
{
this->SetFocus();
MSG ppMsg;
ppMsg.hwnd = this->m_hWnd;
ppMsg.lParam = pMsg->lParam;
ppMsg.message = pMsg->message;
ppMsg.time = pMsg->time;
ppMsg.wParam = pMsg->wParam;
ppMsg.pt = pt;
m_tt.RelayEvent(&ppMsg);
}else if( pMsg->message == 0x02A2 ){
MSG ppMsg;
ppMsg.hwnd = this->m_hWnd;
ppMsg.lParam = pMsg->lParam;
ppMsg.message = pMsg->message;
ppMsg.time = pMsg->time;
ppMsg.wParam = pMsg->wParam;
ppMsg.pt.x = 10000;
ppMsg.pt.y = 10000;
m_tt.RelayEvent(&ppMsg);
}
return CDialog::PreTranslateMessage(pMsg);
}