WM_MOUSEWHEEL消息只能检测到滚轮滚动的方向,那有没有什么办法能检测到滚动的速度呢?

解决方案 »

  1.   

    单位时间的鼠标移动的位移量。v=ds/dt.
    ds^2=(x2-x1)^2+(y2-y1)^2.   dt=t2-t1.
      

  2.   

    BOOL QueryPerformanceCounter(
      LARGE_INTEGER *lpPerformanceCount   // counter value
    );BOOL QueryPerformanceFrequency(
      LARGE_INTEGER *lpFrequency   // current frequency
    );LARGE_INTEGER t1,t2;
    .
    .
    QueryPerformanceCounter(&t1);
    .
    .
    .
    QueryPerformanceCounter(&t2);
    QueryPerformanceFrequency(&f);
    double dt=(double)((t2-t1)/f);
    double vx=(point2.x-point1.x)/dt;  //<---
    double vy=(point2.y-point1.y)/dt;  //<---