钩子教程 - 原理(二十七) : 结构体 -- CBT_CREATEWND / CBTACTIVATESTRUCT / CWPRETSTRUCT
原文地址:http://www.zdexe.com/program/201004/601.html
下面是应用Hook时会用到的各种结构。
结构1:CBT_CREATEWND Structure
The CBT_CREATEWND structure contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.
该结构包含有:在一个窗口被创建之前传递给WH_CBT钩子子程,即CBTProc,的信息。
Syntaxy语法
typedef struct {
LPCREATESTRUCT lpcs;
HWND hwndInsertAfter;
} CBT_CREATEWND, *LPCBT_CREATEWND;
Members成员
lpcs
Pointer to a CREATESTRUCT structure that contains initialization parameters for the window about to be created. 一个指向CREATESTRUCT结构的指针,该结构包含即将被创建的窗体的初始化参数。
hwndInsertAfter
Handle to the window whose position in the Z order precedes that of the window being created.
窗体的句柄,该窗体的Z轴位置在正在被创建的窗体的Z轴位置之前。
---------------------------------------------------------------------------------------------------------------------------------------------------
结构2:CBTACTIVATESTRUCT Structure
The CBTACTIVATESTRUCT structure contains information passed to a WH_CBT hook procedure, CBTProc, before a window is activated.
CBTACTIVATESTRUCT 结构包含在窗体被激活之前,传递给WH_CBT钩子子程CBTProc 的信息。
Syntax
typedef struct {
BOOL fMouse;
HWND hWndActive;
} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;
Members 成员
fMouse
Specifies whether the window is being activated as a result of a mouse click. This value is TRUE if a mouse click is causing the activation or FALSE if it is not. 指定窗体是否是由于鼠标的点击而导致被激活。如果是因为鼠标的点击而引发了窗体的激活,返回true,否则返回false。
hWndActive
Handle to the active window. 活动窗口的句柄。
---------------------------------------------------------------------------------------------------------------------------------------------------
结构3:CWPRETSTRUCT Structure
The CWPRETSTRUCT structure defines the message parameters passed to a WH_CALLWNDPROCRET hook procedure, CallWndRetProc.
CWPRETSTRUCT结构定义了传递给WH_CALLWNDPROCRET钩子子程CallWndRetProc的消息参数。
Syntax语法
typedef struct {
LRESULT lResult;
LPARAM lParam;
WPARAM wParam;
UINT message;
HWND hwnd;
} CWPRETSTRUCT, *PCWPRETSTRUCT;
Members成员
lResult : Specifies the return value of the window procedure that processed the message specified by the message value.
指定了窗体程序的返回值,该窗体程序处理由 message 值指定的消息。
lParam / wParam : Specifies additional information about the message. The exact meaning depends on the message value.
指定消息的附加信息。附加的意义取决于message的值。
message : Specifies the message.
指定消息。
hwnd : Handle to the window that processed the message specified by the message value.
处理由message的值指定的消息的窗体的窗体句柄。