哪些消息可以传递给低级鼠标挂钩回调函数
Which messages can be passed to a low-level mouse hook callback function?
所以,我正在阅读 WinApi 文档,了解低级鼠标钩子的回调函数,我对传递给此函数的 WPARAM 参数感到困惑。
来自有关回调函数的文档:
wParam [in]
Type: WPARAM
The identifier of the mouse message. This parameter can be one of the following messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_RBUTTONDOWN, or WM_RBUTTONUP.
这只提到WM_LBUTTONDOWN、WM_LBUTTONUP、WM_MOUSEMOVE、WM_MOUSEWHEEL、WM_MOUSEHWHEEL、WM_RBUTTONDOWN和WM_RBUTTONUP。
但是在有关 MSLLHOOKSTRUCT 结构(与低级鼠标挂钩一起使用(的文档中,还提到了其他消息:
mouseData
Type: DWORD
If the message is WM_MOUSEWHEEL, the high-order word of this member is the wheel delta. The low-order word is reserved. 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. One wheel click is defined as WHEEL_DELTA, which is 120.
If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, and the low-order word is reserved. This value can be one or more of the following values. Otherwise, mouseData is not used.
这些消息是否也在 WPARAM 参数中传递?
这些消息是否也在 WPARAM 参数中传递?
是的。
例如,如果要处理 X 按钮消息,则使用 WM_XBUTTONDOWN
和 WM_XBUTTONUP
将它们发布到应用程序。wParam 的低阶字表示哪个 X 按钮关闭(如果有的话(。
此外,请参阅响应鼠标点击
WM_XBUTTONDOWN和WM_XBUTTONUP窗口消息适用于两者 XBUTTON1和XBUTTON2。wParam 参数指示哪个按钮是 点击。
UINT button = GET_XBUTTON_WPARAM(wParam);
if (button == XBUTTON1)
{
// XBUTTON1 was clicked.
}
else if (button == XBUTTON2)
{
// XBUTTON2 was clicked.
}
相关文章:
- "error: no matching function for call to"构造函数错误
- 什么时候调用组成单元对象的析构函数
- 继承函数的重载解析
- 为什么随机数生成器不在void函数中随机化数字,而在main函数中随机化
- C++模板来检查友元函数的存在
- 递归函数计算序列中的平方和(并输出过程)
- 对RValue对象调用的LValue ref限定成员函数
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 在C++STL中是否有Polyval(Matlab函数)等价物?
- 为什么使用 "this" 指针调用派生成员函数?
- 将对象数组的引用传递给函数
- 我想制作设置鼠标回调函数,以便在仍然按下鼠标左键时连续传递坐标
- 哪些消息可以传递给低级鼠标挂钩回调函数
- 如何在mousepressEvent()函数中显示像素坐标,然后如何在每次单击鼠标时在paintGL()函数中将其使用
- 无法在QT中单击鼠标时调用C++函数
- 声明在 Qt 中发生鼠标事件时调用的函数
- c++中使用push_back的一个鼠标回调函数
- 鼠标回调函数 OpenCV
- 鼠标回调函数中void*转换为int*** (opencvc++)