Translates a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.
#Include <WinAPIEx.au3>
_WinAPI_MapVirtualKey ( $iCode, $iType )
$iCode | The virtual key code or scan code for a key. How this value is interpreted depends on the $iType parameter. |
$iType | The translation to be performed. This value depends on the value of the $iCode parameter and can be one of the following values. $MAPVK_VK_TO_CHAR $MAPVK_VK_TO_VSC $MAPVK_VSC_TO_VK $MAPVK_VSC_TO_VK_EX |
Success | A scan code, a virtual-key code, or a character value, depending on the above parameters. |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
ConsoleWrite('Virtual-key code: 0x' & Hex($VK_A) & @CR)
ConsoleWrite('Scan code: 0x' & Hex(_WinAPI_MapVirtualKey($VK_A, $MAPVK_VK_TO_VSC)) & @CR)