我想用WM_MOUSEMOVE消息,可是SDK不认,我应该怎么做呢,msdn上没例子。

解决方案 »

  1.   

    #include "Windows.h"// WndProc 主窗口过程LRESULT WINAPI WndProc( HWND hWnd, UINT msg, WPARAM wParam,LPARAM lParam )
    {
         INT      nXpos, nYpos;     switch( msg )
         {
         case WM_MOUSEMOVE:
              {
                    nXpos = GET_X_LPARAM(lParam); 
                    nYpos = GET_Y_LPARAM(lParam);                 ...
               }
               break;
               
               ...
         }
    }
              
      

  2.   

    WM_MOUSELEAVE:
      WPARAM wParam,   // not used
      LPARAM lParam    // not usedcase WM_MOUSELEAVE:
    {
         // 鼠标离开了窗体客户区
       
         // Do something
         ...
    }
      

  3.   

    requirs add 
    #define _WIN32_WINNT >= 0x0400
    Using the ::TrackMouseEvent API is the MS prefered method of finding when
    the mouse leaves a window in Windows 98 and NT 4.0
      

  4.   

    see MSDN Article ID:
    Q183107, "HOWTO: Detect When the Cursor Leaves the Window",