钩子教程 - 原理(二十九) : 结构体 -- KBDLLHOOKSTRUCT

原文地址 : http://www.zdexe.com/program/201004/603.html

结构7:KBDLLHOOKSTRUCT Structure

The KBDLLHOOKSTRUCT structure contains information about a low-level keyboard input event.

  该结构包含有低层键盘输入事件的信息。

Syntax语法

typedef struct {
    DWORD vkCode;
    DWORD scanCode;
    DWORD flags;
    DWORD time;
    ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;

Members成员

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

  指定虚拟键值。该值必须在1到254的范围内。

scanCode : Specifies a hardware scan code for the key.

  指定键的硬件扫描码。

flags : Specifies the extended-key flag, event-injected flag, context code, and transition-state flag. This member is specified as follows. An application can use the following values to test the keystroke flags.

  指定扩展键标志,事件注入标志,上下文代码,转换状态码。成员如下所示。应用程序可以使用下列值来检查键盘敲击标志。

 

Value值

Purpose目的

LLKHF_EXTENDED

Test the extended-key flag. 测试扩展键标志。

LLKHF_INJECTED

Test the event-injected flag. 测试事件注入标志。

LLKHF_ALTDOWN

Test the context code. 测试上下文代码。

LLKHF_UP

Test the transition-state flag. 测试转换状态码。

 

  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,否则为0。

  1-3 :Reserved. 

    保留。

  4  :Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0. 

    指定事件是否被注入。被注入为1,否则为0。

  5  :Specifies the context code. The value is 1 if the ALT key is pressed; otherwise, it is 0. 

    指定上下文代码。如果按下了ALT,该值为1,否则为0

  6  :Reserved. 

    保留。

  7  :Specifies the transition state. The value is 0 if the key is pressed and 1 if it is being released.

    指定转换状态。如果该键被按下该值为1,如果被释放为0。

time : Specifies the time stamp for this message, equivalent to what GetMessageTime would return for this message. 

  指定消息的时间戳,相当于GetMessageTime返回的值。

dwExtraInfo : Specifies extra information associated with the message. 

  指定和该消息相关联的扩展信息。

 

posted @ 2016-05-17 15:13  C/C++/Python/Java  阅读(3434)  评论(0编辑  收藏  举报