在PreTranslateMessage函数中捕获 WM_MOUSEWHEEL消息,怎么判断滚轮的方向?

windforce1210 2017-11-05 01:31:24
由于程序里加入了其他的消息相应类,所以对话框本身的OnMouseWheel函数,不响应鼠标滚轮了,只能用PreTranslateMessage函数里判断WM_MOUSEWHEEL消息来相应,但是在PreTranslateMessage里怎么判断滚轮的方向啊?求指导!!!
...全文
611 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgl7903 2017-11-06
  • 打赏
  • 举报
回复
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
schlafenhamster 2017-11-06
  • 打赏
  • 举报
回复
int zDelta=HIWORD(wParam);
windforce1210 2017-11-05
  • 打赏
  • 举报
回复
引用 4 楼 schlafenhamster 的回复:
MSG Structure The MSG structure has the following form: typedef struct tagMSG { // msg HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG;
你好!看了你给的说明,是wParam这个参数高位一个字的数据,但我看了wParam这个参数的内存,向上是是 00 00 78 00 00 00 00 00 向下是00 00 88 ff ff ff ff ff 请问这个怎么对应啊?
schlafenhamster 2017-11-05
  • 打赏
  • 举报
回复
MSG Structure The MSG structure has the following form: typedef struct tagMSG { // msg HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG;
schlafenhamster 2017-11-05
  • 打赏
  • 举报
回复
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.
windforce1210 2017-11-05
  • 打赏
  • 举报
回复
在OnMouseWheel这个函数下,可以用short zDelta,可以在PreTranslateMessage这个函数下,没有这个参数传进来啊??
nicklisir 2017-11-05
  • 打赏
  • 举报
回复
short zDelta 正负 判断下据可以
m0_46195138 2021-07-07
  • 举报
回复
@nicklisir 这个zDelta上下滚都是正值,没有负值的出现

16,550

社区成员

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

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

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