鈎子教程 - 原理(三十) : 結構體 -- 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鍵被按下或者釋放。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM