网站首页  词典首页

请输入您要查询的函数:

 

术语 getasynckeystate
释义 GetAsyncKeyState
语法:
SHORT GetAsyncKeyState( int vKey
);
GetAsyncKeyState函数
该GetAsyncKeyState函数确定的关键在于是否向上或在该函数被调用时下来,关键在于是否在以前调用GetAsyncKeyState的压力。
参数
vKey
[in]指定了256个可能的虚拟键码之一。有关更多信息,请参阅虚拟密钥代码。
Windows NT/2000/XP的:您可以使用左,右区分常量来指定某些项。请参阅更多信息备注部分。
返回值
如果函数成功,返回值指定是否键被按下自上次调用GetAsyncKeyState,是否目前的关键是上涨或下跌。如果最重要的位被设置,关键是下,如果最低有效位被设置,关键是先前的呼吁后,对GetAsyncKeyState的压力。但是,您不应该依靠最后的行为;有关详细信息,请参见备注。
Windows NT/2000/XP的:返回值是零以下情况:
当前的桌面不是活动桌面
在前台线程属于另一个进程和桌面不允许钩或杂志的记录。
在Windows 95/98/Me:返回值是全球异步为每个虚拟密钥的状态。该系统不检查的线程键盘焦点。
Windows 95/98/Me中:Windows 95不支持左,右区分常数。如果您调用这些常量GetAsyncKeyState,返回值是零。
备注
该GetAsyncKeyState功能可与鼠标按钮。但是,检查对身体鼠标按钮的状态,而不是逻辑鼠标的物理按钮映射到按钮。例如,调用GetAsyncKeyState(VK_LBUTTON)总是返回左物理鼠标按钮的状态,无论是映射到逻辑向左或向右鼠标按钮。您可以确定系统的物理鼠标按钮当前映射到逻辑鼠标按钮调用
GetSystemMetrics(SM_SWAPBUTTON)
它返回TRUE,如果鼠标按钮被交换。
尽管返回值的最低有效位表示是否键被按下自上次查询,由于先发制人的Windows多任务的性质,另一个应用程序可以调用GetAsyncKeyState,接受“最近按下”位,而不是您的应用程序。该返回值的最低有效位的行为保留严格的兼容性与16位Windows应用程序(这些非抢占式),而不应依赖。
您可以使用虚拟键码常数VK_SHIFT,VK_CONTROL,并VK_MENU作为对vKey参数值。这使无左派和右派之间的区分SHIFT键,CTRL或ALT键的状态。
Windows NT/2000/XP的:您可以使用下列虚拟价值为vKey键码常数区分这些键左,右实例。
CodeMeaning
VK_LSHIFTLeft移的关键。
VK_RSHIFTRight移的关键。
VK_LCONTROLLeft控制的关键。
VK_RCONTROLRight控制的关键。
VK_LMENULeft菜单的关键。
VK_RMENURight菜单的关键。
这些左,右区分常数只提供当调用GetKeyboardState,SetKeyboardState,GetAsyncKeyState,GetKeyState和MapVirtualKey功能。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
键盘输入,GetKeyboardState,GetKeyState,GetSystemMetrics,MapVirtualKey,SetKeyboardState
==英文原文==GetAsyncKeyState Function
The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
Syntax
SHORT GetAsyncKeyState( int vKey
);
Parameters
vKey
[in] Specifies one of 256 possible virtual-key codes. For more information, see Virtual Key Codes .
Windows NT/2000/XP: You can use left- and right-distinguishing constants to specify certain keys. See the Remarks section for further information.
Return Value
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. However, you should not rely on this last behavior; for more information, see the Remarks.
Windows NT/2000/XP: The return value is zero for the following cases:
The current desktop is not the active desktop
The foreground thread belongs to another process and the desktop does not allow the hook or the journal record.
Windows 95/98/Me: The return value is the global asynchronous key state for each virtual key. The system does not check which thread has the keyboard focus.
Windows 95/98/Me: Windows 95 does not support the left- and right-distinguishing constants. If you call GetAsyncKeyState with these constants, the return value is zero.
Remarks
The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example, the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button. You can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling
GetSystemMetrics(SM_SWAPBUTTON)
which returns TRUE if the mouse buttons have been swapped.
Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon.
You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right.
Windows NT/2000/XP: You can use the following virtual-key code constants as values for vKey to distinguish between the left and right instances of those keys.
CodeMeaning
VK_LSHIFTLeft-shift key.
VK_RSHIFTRight-shift key.
VK_LCONTROLLeft-control key.
VK_RCONTROLRight-control key.
VK_LMENULeft-menu key.
VK_RMENURight-menu key.
These left- and right-distinguishing constants are only available when you call the GetKeyboardState , SetKeyboardState , GetAsyncKeyState, GetKeyState , and MapVirtualKey functions.
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 , GetKeyboardState , GetKeyState , GetSystemMetrics , MapVirtualKey , SetKeyboardState
==原始网址==http://msdn.microsoft.com/en-us/library/ms646293(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:22:41