LRESULT CSkinDialog::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lrst = TRUE; if (!::IsWindow(m_hWnd)) return lrst; //重绘标题栏 if (message==WM_NCPAINT||message==WM_NCACTIVATE) { DrawTitleBar(); return lrst; } //鼠标双击标题栏 if(message==WM_NCLBUTTONDBLCLK){ CPoint pt; ::GetCursorPos(&pt); OnNcLButtonDblClk(pt); return lrst; } //鼠标按下处理 if(message==WM_NCLBUTTONDOWN){ CPoint pt; ::GetCursorPos(&pt); if(OnNcLButtonDown(pt)){ return lrst; } } //重新计算标题栏高度 if(message==WM_NCCALCSIZE){ NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)lParam; BOOL bCalcValidRects = (BOOL)wParam; OnNcCalcSize(bCalcValidRects,lpncsp); } //鼠标焦点处理 if(message==WM_NCMOUSEMOVE){ CPoint pt; ::GetCursorPos(&pt); OnNcMouseMove(pt); } //鼠标弹起处理 if(message==WM_NCLBUTTONUP){ CPoint pt; ::GetCursorPos(&pt); OnNcLButtonUp(pt); } //鼠标离开标题栏处理 if(message==WM_NCMOUSELEAVE){ OnNcMouseLeave(); } //默认消息处理 return CDialog::DefWindowProc(message, wParam, lParam); }
bool CMouseLeaveTrack::OnMessage(UINT Msg,WPARAM wParam,LPARAM lParam) { switch (Msg) { case WM_MOUSEMOVE: OnMouseMove(); return true; case WM_MOUSELEAVE: OnMouseLeave(); return true; case WM_NCMOUSEMOVE: OnNcMouseMove(); return true; case WM_NCMOUSELEAVE: OnNcMouseLeave(); return true; } return false; }