WM_MOUSELEAVE WM_MOUSEHOVER

1. error LNK2001: 无法解析的外部符号__imp___TrackMouseEvent@4

解决方案:

#include

#pragma  comment(lib,"Comctl32.lib")

2.WM_MOUSEMOVE 中用::_TrackMouseEvent(&csTME);     开启Windows的WM_MOUSELEAVE,WM_MOUSEHOVER事件支持

3.case WM_MOUSEMOVE:
  {
   m_bTrackMouse=TRUE;
   if (m_bTrackMouse)    //若允许追踪,则。
   {
    TRACKMOUSEEVENT csTME;
    csTME.cbSize = sizeof(csTME);
    csTME.dwFlags = TME_LEAVE|TME_HOVER;
    csTME.hwndTrack = m_hWnd;         //指定要追踪的窗口
    csTME.dwHoverTime = 30;           //鼠标在按钮上停留超过xxms,才认为状态为HOVER  
    ::_TrackMouseEvent(&csTME);       //开启Windows的WM_MOUSELEAVE,WM_MOUSEHOVER事件支持
    m_bTrackMouse=FALSE;              //若已经追踪,则停止追踪
   }
  }

4. case WM_MOUSELEAVE:
  {
   m_bTrackMouse=TRUE;
  }

5.case WM_MOUSEHOVER:
  {

// what you want to do

 }

你可能感兴趣的:(WM_MOUSELEAVE WM_MOUSEHOVER)