网站首页  词典首页

请输入您要查询的函数:

 

术语 getkeystate
释义 GetKeyState
语法:
SHORT GetKeyState( int nVirtKey
);
GetKeyState函数
该GetKeyState函数检索指定虚拟键的状态。指定的地位,关键在于是否向上,向下,或切换(开,关,每次交替键被按下的时间)。
参数
nVirtKey
[in]指定一个虚拟的关键。如果所需的虚拟键是一个字母或数字(A到Z,甲A到Z,或通过9 0),nVirtKey必须设置该字符的ASCII值。对于其他键,它必须是一个虚拟键码。
如果一个非英语键盘布局使用的范围与A值的ASCII到Z和0到9用于指定的字符键最虚拟键。例如,德国的键盘布局,价值的虚拟键的ASCII澳(0x4F)指的是“o”键,而VK_OEM_1是指与变音“o”键。
返回值
返回值指定指定虚拟键的状态,如下:
如果高序位为1,关键是降低,否则,就到了。
如果低序位是1,关键是切换。一个关键,如CAPS LOCK键,切换是如果它打开。关键是起飞和untoggled如果低序位为0。阿切换键的指示灯(如有),在键盘上时,将是关键切换,和关闭时,关键是untoggled。
备注
关键的地位,作为一个线程从这个函数返回读取的变化从消息队列中的关键信息。的状态并不反映中断一级的国家与硬件相关的。使用GetAsyncKeyState函数来检索该信息。
应用程序调用的响应键盘输入消息GetKeyState。此函数检索输入消息时,生成的主要国家。
要检索所有的虚拟键的状态信息,请使用GetKeyboardState功能。
应用程序可以使用的虚拟键码常数VK_SHIFT,VK_CONTROL,并VK_MENU作为对nVirtKey参数值。这使无左派和右派之间的区分SHIFT键,Ctrl或Alt键的状态。应用程序也可以使用下列虚拟价值为nVirtKey键码常数区分这些键左,右实例。
VK_LSHIFT
VK_RSHIFT
VK_LCONTROL
VK_RCONTROL
VK_LMENU
VK_RMENU
这些左,右区分常量可用于应用程序只能通过GetKeyboardState,SetKeyboardState,GetAsyncKeyState,GetKeyState和MapVirtualKey功能。
有关示例,请参见显示键盘输入。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
键盘输入,GetAsyncKeyState,GetKeyboardState,MapVirtualKey,SetKeyboardState
==英文原文==GetKeyState Function
The GetKeyState function retrieves the status of the specified virtual key. The status specifies whether the key is up, down, or toggled (on, off—alternating each time the key is pressed).
Syntax
SHORT GetKeyState( int nVirtKey
);
Parameters
nVirtKey
[in] Specifies a virtual key. If the desired virtual key is a letter or digit (A through Z, a through z, or 0 through 9), nVirtKey must be set to the ASCII value of that character. For other keys, it must be a virtual-key code.
If a non-English keyboard layout is used, virtual keys with values in the range ASCII A through Z and 0 through 9 are used to specify most of the character keys. For example, for the German keyboard layout, the virtual key of value ASCII O (0x4F) refers to the "o" key, whereas VK_OEM_1 refers to the "o with umlaut" key.
Return Value
The return value specifies the status of the specified virtual key, as follows:
If the high-order bit is 1, the key is down; otherwise, it is up.
If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.
Remarks
The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
To retrieve state information for all the virtual keys, use the GetKeyboardState function.
An application can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the nVirtKey parameter. This gives the status of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. An application can also use the following virtual-key code constants as values for nVirtKey to distinguish between the left and right instances of those keys.
VK_LSHIFT
VK_RSHIFT
VK_LCONTROL
VK_RCONTROL
VK_LMENU
VK_RMENU
These left- and right-distinguishing constants are available to an application only through the GetKeyboardState, SetKeyboardState , GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
For an example, see Displaying Keyboard Input .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
Keyboard Input , GetAsyncKeyState , GetKeyboardState , MapVirtualKey , SetKeyboardState
==原始网址==http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:28:05