SetWindowsHookEx 详解(四)所有结构体

MOUSEHOOKSTRUCT structure

Contains information about a mouse event passed to a WH_MOUSE hook procedure, MouseProc.

Syntax

C++
Copy
typedef struct tagMOUSEHOOKSTRUCT {
  POINT     pt;
  HWND      hwnd;
  UINT      wHitTestCode;
  ULONG_PTR dwExtraInfo;
} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;

Members

pt

Type: POINT

The x- and y-coordinates of the cursor, in screen coordinates.

hwnd

Type: HWND

A handle to the window that will receive the mouse message corresponding to the mouse event.

wHitTestCode

Type: UINT

The hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message.

dwExtraInfo

Type: ULONG_PTR

Additional information associated with the message.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

MSLLHOOKSTRUCT structure

Contains information about a low-level mouse input event.

Syntax

C++
Copy
typedef struct tagMSLLHOOKSTRUCT {
  POINT     pt;
  DWORD     mouseData;
  DWORD     flags;
  DWORD     time;
  ULONG_PTR dwExtraInfo;
} MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT, *LPMSLLHOOKSTRUCT;

Members

pt

Type: POINT

The x- and y-coordinates of the cursor, in screen coordinates.

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.

Value Meaning
XBUTTON1
0x0001

The first X button was pressed or released.

XBUTTON2
0x0002

The second X button was pressed or released.

 

flags

Type: DWORD

The event-injected flags. An application can use the following values to test the flags. Testing LLMHF_INJECTED (bit 0) will tell you whether the event was injected. If it was, then testing LLMHF_LOWER_IL_INJECTED (bit 1) will tell you whether or not the event was injected from a process running at lower integrity level.

Value Meaning
LLMHF_INJECTED
0x00000001

Test the event-injected (from any process) flag.

LLMHF_LOWER_IL_INJECTED
0x00000002

Test the event-injected (from a process running at lower integrity level) flag.

 

time

Type: DWORD

The time stamp for this message.

dwExtraInfo

Type: ULONG_PTR

Additional information associated with the message.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

MSG structure

Contains message information from a thread's message queue.

Syntax

C++
Copy
typedef struct tagMSG {
  HWND   hwnd;
  UINT   message;
  WPARAM wParam;
  LPARAM lParam;
  DWORD  time;
  POINT  pt;
} MSG, *PMSG, *LPMSG;

Members

hwnd

Type: HWND

A handle to the window whose window procedure receives the message. This member is NULL when the message is a thread message.

message

Type: UINT

The message identifier. Applications can only use the low word; the high word is reserved by the system.

wParam

Type: WPARAM

Additional information about the message. The exact meaning depends on the value of the message member.

lParam

Type: LPARAM

Additional information about the message. The exact meaning depends on the value of the message member.

time

Type: DWORD

The time at which the message was posted.

pt

Type: POINT

The cursor position, in screen coordinates, when the message was posted.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Winuser.h (include Windows.h)

RECT structure

The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.

Syntax

C++
Copy
typedef struct _RECT {
  LONG left;
  LONG top;
  LONG right;
  LONG bottom;
} RECT, *PRECT;

Members

left

The x-coordinate of the upper-left corner of the rectangle.

top

The y-coordinate of the upper-left corner of the rectangle.

right

The x-coordinate of the lower-right corner of the rectangle.

bottom

The y-coordinate of the lower-right corner of the rectangle.

Remarks

By convention, the right and bottom edges of the rectangle are normally considered exclusive. In other words, the pixel whose coordinates are ( right, bottom ) lies immediately outside of the rectangle. For example, when RECT is passed to the FillRect function, the rectangle is filled up to, but not including, the right column and bottom row of pixels. This structure is identical to the RECTL structure.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Windef.h (include Windows.h)

EVENTMSG structure

Contains information about a hardware message sent to the system message queue. This structure is used to store message information for the JournalPlaybackProc callback function.

Syntax

C++
Copy
typedef struct tagEVENTMSG {
  UINT  message;
  UINT  paramL;
  UINT  paramH;
  DWORD time;
  HWND  hwnd;
} EVENTMSG, *PEVENTMSG, *LPEVENTMSG;

Members

message

Type: UINT

The message.

paramL

Type: UINT

Additional information about the message. The exact meaning depends on the message value.

paramH

Type: UINT

Additional information about the message. The exact meaning depends on the message value.

time

Type: DWORD

The time at which the message was posted.

hwnd

Type: HWND

A handle to the window to which the message was posted.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

KBDLLHOOKSTRUCT structure

Contains information about a low-level keyboard input event.

Syntax

C++
Copy
typedef struct tagKBDLLHOOKSTRUCT {
  DWORD     vkCode;
  DWORD     scanCode;
  DWORD     flags;
  DWORD     time;
  ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT, *LPKBDLLHOOKSTRUCT;

Members

vkCode

Type: DWORD

A virtual-key code. The code must be a value in the range 1 to 254.

scanCode

Type: DWORD

A hardware scan code for the key.

flags

Type: DWORD

The extended-key flag, event-injected flags, context code, and transition-state flag. This member is specified as follows. An application can use the following values to test the keystroke flags. Testing LLKHF_INJECTED (bit 4) will tell you whether the event was injected. If it was, then testing LLKHF_LOWER_IL_INJECTED (bit 1) will tell you whether or not the event was injected from a process running at lower integrity level.

Value Meaning
LLKHF_EXTENDED
(KF_EXTENDED >> 8)

Test the extended-key flag.

LLKHF_LOWER_IL_INJECTED
0x00000002

Test the event-injected (from a process running at lower integrity level) flag.

LLKHF_INJECTED
0x00000010

Test the event-injected (from any process) flag.

LLKHF_ALTDOWN
(KF_ALTDOWN >> 8)

Test the context code.

LLKHF_UP
(KF_UP >> 8)

Test the transition-state flag.

 

The following table describes the layout of this value.

Bits Description
0 Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0.
1 Specifies whether the event was injected from a process running at lower integrity level. The value is 1 if that is the case; otherwise, it is 0. Note that bit 4 is also set whenever bit 1 is set.
2-3 Reserved.
4 Specifies whether the event was injected. The value is 1 if that is the case; otherwise, it is 0. Note that bit 1 is not necessarily set when bit 4 is set.
5 The context code. The value is 1 if the ALT key is pressed; otherwise, it is 0.
6 Reserved.
7 The transition state. The value is 0 if the key is pressed and 1 if it is being released.

 

time

Type: DWORD

The time stamp for this message, equivalent to what GetMessageTime would return for this message.

dwExtraInfo

Type: ULONG_PTR

Additional information associated with the message.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

CWPSTRUCT structure

Defines the message parameters passed to a WH_CALLWNDPROC hook procedure, CallWndProc.

Syntax

C++
Copy
typedef struct tagCWPSTRUCT {
  LPARAM lParam;
  WPARAM wParam;
  UINT   message;
  HWND   hwnd;
} CWPSTRUCT, *PCWPSTRUCT, *LPCWPSTRUCT;

Members

lParam

Type: LPARAM

Additional information about the message. The exact meaning depends on the message value.

wParam

Type: WPARAM

Additional information about the message. The exact meaning depends on the message value.

message

Type: UINT

The message.

hwnd

Type: HWND

A handle to the window to receive the message.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

CWPRETSTRUCT structure

Defines the message parameters passed to a WH_CALLWNDPROCRET hook procedure, CallWndRetProc.

Syntax

C++
Copy
typedef struct tagCWPRETSTRUCT {
  LRESULT lResult;
  LPARAM  lParam;
  WPARAM  wParam;
  UINT    message;
  HWND    hwnd;
} CWPRETSTRUCT, *PCWPRETSTRUCT, *LPCWPRETSTRUCT;

Members

lResult

Type: LRESULT

The return value of the window procedure that processed the message specified by the message value.

lParam

Type: LPARAM

Additional information about the message. The exact meaning depends on the message value.

wParam

Type: WPARAM

Additional information about the message. The exact meaning depends on the message value.

message

Type: UINT

The message.

hwnd

Type: HWND

A handle to the window that processed the message specified by the message value.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

CBT_CREATEWND structure

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.

Syntax

C++
Copy
typedef struct tagCBT_CREATEWND {
  LPCREATESTRUCT lpcs;
  HWND           hwndInsertAfter;
} CBT_CREATEWND, *LPCBT_CREATEWND;

Members

lpcs

Type: LPCREATESTRUCT

A pointer to a CREATESTRUCT structure that contains initialization parameters for the window about to be created.

hwndInsertAfter

Type: HWND

A handle to the window whose position in the Z order precedes that of the window being created. This member can also be NULL.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Unicode and ANSI names

CBT_CREATEWNDW (Unicode) and CBT_CREATEWNDA (ANSI)

CBTACTIVATESTRUCT structure

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is activated.

Syntax

C++
Copy
typedef struct tagCBTACTIVATESTRUCT {
  BOOL fMouse;
  HWND hWndActive;
} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;

Members

fMouse

Type: BOOL

This member is TRUE if a mouse click is causing the activation or FALSE if it is not.

hWndActive

Type: HWND

A handle to the active window.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

CBT_CREATEWND structure

Contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.

Syntax

C++
Copy
typedef struct tagCBT_CREATEWND {
  LPCREATESTRUCT lpcs;
  HWND           hwndInsertAfter;
} CBT_CREATEWND, *LPCBT_CREATEWND;

Members

lpcs

Type: LPCREATESTRUCT

A pointer to a CREATESTRUCT structure that contains initialization parameters for the window about to be created.

hwndInsertAfter

Type: HWND

A handle to the window whose position in the Z order precedes that of the window being created. This member can also be NULL.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Unicode and ANSI names

CBT_CREATEWNDW (Unicode) and CBT_CREATEWNDA (ANSI)

DEBUGHOOKINFO structure

Contains debugging information passed to a WH_DEBUG hook procedure, DebugProc.

Syntax

C++
Copy
typedef struct tagDEBUGHOOKINFO {
  DWORD  idThread;
  DWORD  idThreadInstaller;
  LPARAM lParam;
  WPARAM wParam;
  int    code;
} DEBUGHOOKINFO, *PDEBUGHOOKINFO, *LPDEBUGHOOKINFO;

Members

idThread

Type: DWORD

A handle to the thread containing the filter function.

idThreadInstaller

Type: DWORD

A handle to the thread that installed the debugging filter function.

lParam

Type: LPARAM

The value to be passed to the hook in the lParam parameter of the DebugProc callback function.

wParam

Type: WPARAM

The value to be passed to the hook in the wParam parameter of the DebugProc callback function.

code

Type: int

The value to be passed to the hook in the nCode parameter of the DebugProc callback function.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)


你可能感兴趣的:(编程语言,Window,API)