用什么方法可以判断鼠标滚轮的滚动方向?

tangible7788 2003-11-12 07:31:21
用什么方法可以判断鼠标滚轮的滚动方向?
比如某个API
...全文
412 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingofvc 2003-11-21
  • 打赏
  • 举报
回复
LPARAM old;
OnRegisteredMouseWheel( WPARAM wParam, LPARAM lParam );
if (old<lParam) 向下
if (old>lParam) 向上
old=lParam;
COOL099 2003-11-21
  • 打赏
  • 举报
回复
WM_MOUSEWHEEL
The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.

WM_MOUSEWHEEL
fwKeys = LOWORD(wParam); // key flags
zDelta = (short) HIWORD(wParam); // wheel rotation
xPos = (short) LOWORD(lParam); // horizontal position of pointer
yPos = (short) HIWORD(lParam); // vertical position of pointer

zDelta
The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

chocobo 2003-11-21
  • 打赏
  • 举报
回复
DirectInput 中 DirectMouse 可以拿到,不过要求自己在屏幕上画出鼠标。
tangible7788 2003-11-21
  • 打赏
  • 举报
回复
我想在底层获得滚轮滚动的方向,不晓得改如何做?
dzqsuper 2003-11-12
  • 打赏
  • 举报
回复
zDelta

Indicates distance rotated. The zDelta value is expressed in multiples or divisions of WHEEL_DELTA, which is 120. A value less than zero indicates rotating back (toward the user) while a value greater than zero indicates rotating forward (away from the user). The user can reverse this response by changing the Wheel setting in the mouse software. See the Remarks for more information about this parameter.

topwork 2003-11-12
  • 打赏
  • 举报
回复
重载窗口的OnMouseWheel事件,中间那个参数zDelta是正的就是向前滚,是负的说明向后滚,一般来说是120和-120

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧