现在的位置: 首页 > 综合 > 正文

鼠标移出窗口消息

2013年04月02日 ⁄ 综合 ⁄ 共 667字 ⁄ 字号 评论关闭

请看源码,原理查MSDN中的TrackMouseEvent   
  void   CMouseMoveDlg::OnMouseMove(UINT   nFlags,   CPoint   point)     
  {   
  //   TODO:   Add   your   message   handler   code   here   and/or   call   default   
  LPTRACKMOUSEEVENT   lpET=new   TRACKMOUSEEVENT;   //一直是new?
  lpET->cbSize=sizeof(TRACKMOUSEEVENT);   
  lpET->dwFlags=TME_LEAVE;   
  lpET->dwHoverTime=NULL;   
  lpET->hwndTrack=this->m_hWnd;   
  _TrackMouseEvent(lpET);   
  CDialog::OnMouseMove(nFlags,   point);   
  }   
    
  BOOL   CMouseMoveDlg::PreTranslateMessage(MSG*   pMsg)     
  {   
  //   TODO:   Add   your   specialized   code   here   and/or   call   the   base   class   
  if   (pMsg->message==WM_MOUSELEAVE)   
  {   
  MessageBox("鼠标移出了窗体");   
                    }   
  return   CDialog::PreTranslateMessage(pMsg);   
  }

抱歉!评论已关闭.