钩子教程 - 原理(三十) : 结构体 -- MOUSEHOOKSTRUCT / MOUSEHOOKSTRUCTEX
原文地址:http://www.zdexe.com/program/201004/604.html
结构8 :MOUSEHOOKSTRUCT Structure
The MOUSEHOOKSTRUCT structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.
MOUSEHOOKSTRUCT结构包含有传递给WH_MOUSE钩子子程MouseProc的,关于鼠标事件的信息。
Syntax语法
typedef struct {
POINT pt;
HWND hwnd;
UINT wHitTestCode;
ULONG_PTR dwExtraInfo;
} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT;
Members成员
pt :Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates. 指定在屏幕坐标系下,包含有光标x、y坐标的POINT结构。
hwnd : Handle to the window that will receive the mouse message corresponding to the mouse event. 希望对鼠标事件做出响应、接收鼠标消息的窗体的句柄。
wHitTestCode :Specifies the hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message. 指定点击测试值。查看WM_NCHITTEST消息可以得到值的列表。
dwExtraInfo :Specifies extra information associated with the message. 指定和该消息相关联的附加信息。
结构9:MOUSEHOOKSTRUCTEX Structure
The MOUSEHOOKSTRUCTEX structure contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.
MOUSEHOOKSTRUCTEX结构包含有传递给WH_MOUSE钩子子程MouseProc的关于鼠标事件的信息。
This is an extension of the MOUSEHOOKSTRUCT structure that includes information about wheel movement or the use of the X button.
这是对MOUSEHOOKSTRUCT的扩展。包含有滚轮的活动和X键的使用。
Syntax语法
typedef struct {
MOUSEHOOKSTRUCT MOUSEHOOKSTRUCT;
DWORD mouseData;
} MOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;
Members成员
MOUSEHOOKSTRUCT
The members of a MOUSEHOOKSTRUCT structure make up the first part of this structure.
MOUSEHOOKSTRUCT结构的成员构成了该结构的前面部分。
mouseData
If the message is WM_MOUSEWHEEL, the HIWORD of this member is the wheel delta. The LOWORD is undefined and 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.
如果消息是WM_MOUSEWHEEL,该成员的HIWORD就是wheel delta。LOWORD做为保留未定义。正值表示滚轮向前旋转,即远离用户的方向;负值表示滚轮向后旋转,即朝向用户的方向。滚轮的点击被定义为WHEEL_DELTA,具体值为120。
If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the HIWORD of mouseData specifies which X button was pressed or released, and the LOWORD is undefined and reserved. This member can be one or more of the following values. Otherwise,mouseData is not used.
如果消息是WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, 或者WM_NCXBUTTONDBLCLK, mouseData 的HIWORD值指定哪个X键被按下或者释放,LOWORD做为保留未定义。该成员可以是以下值中的一个或者多个。否则,mouseData未使用。
1.XBUTTON1 :The first X button was pressed or released. 第一个X键被按下或者释放。
2.XBUTTON2 :The second X button was pressed or released.第二个X键被按下或者释放。