#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIEx.au3>
Global Const $WM_HOTKEY = 0x0312
Global $hWnd
$Num = ''
$hWnd = GUICreate("快速下单例子-by lynfr8", 633, 452, 290, 150)
GUIRegisterMsg($WM_HOTKEY, 'WM_HOTKEY')
$Label1 = GUICtrlCreateLabel("字母", 24, 384, 100, 57)
$Label2 = GUICtrlCreateLabel("数字", 152, 384, 148, 73)
$Group1 = GUICtrlCreateGroup("菜单", 8, 8, 609, 361)
$Label3 = GUICtrlCreateLabel("使用方法:1.空格消除 2.回车下单", 48, 56, 380, 201)
GUICtrlCreateGroup("", -99, -99, 1, 1)
_WinAPI_RegisterHotKey($hWnd, 0x0160, 0, 0x60);0
_WinAPI_RegisterHotKey($hWnd, 0x0161, 0, 0x61);1
_WinAPI_RegisterHotKey($hWnd, 0x0162, 0, 0x62);2
_WinAPI_RegisterHotKey($hWnd, 0x0163, 0, 0x63);3
_WinAPI_RegisterHotKey($hWnd, 0x0164, 0, 0x64);4
_WinAPI_RegisterHotKey($hWnd, 0x0165, 0, 0x65);5
_WinAPI_RegisterHotKey($hWnd, 0x0166, 0, 0x66);6
_WinAPI_RegisterHotKey($hWnd, 0x0167, 0, 0x67);7
_WinAPI_RegisterHotKey($hWnd, 0x0168, 0, 0x68);8
_WinAPI_RegisterHotKey($hWnd, 0x0169, 0, 0x69);9
_WinAPI_RegisterHotKey($hWnd, 0x0141, 0, 0x41);A
_WinAPI_RegisterHotKey($hWnd, 0x0142, 0, 0x42);B
_WinAPI_RegisterHotKey($hWnd, 0x0143, 0, 0x43);C
_WinAPI_RegisterHotKey($hWnd, 0x0144, 0, 0x44);D
_WinAPI_RegisterHotKey($hWnd, 0x0145, 0, 0x45);E
_WinAPI_RegisterHotKey($hWnd, 0x0151, 0, 0x51);Q
_WinAPI_RegisterHotKey($hWnd, 0x0152, 0, 0x52);R
_WinAPI_RegisterHotKey($hWnd, 0x0157, 0, 0x57);W
_WinAPI_RegisterHotKey($hWnd, 0x0158, 0, 0x58);X
_WinAPI_RegisterHotKey($hWnd, 0x015A, 0, 0x5A);Z
_WinAPI_RegisterHotKey($hWnd, 0x0120, 0, 0x20);空格
_WinAPI_RegisterHotKey($hWnd, 0x010D, 0, 0x0D);回车
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_HOTKEY($hWnd, $iMsg, $wParam, $lParam)
Switch _WinAPI_HiWord($lParam)
Case 0x60
$Num = $Num & '0'
GUICtrlSetData($Label2, $Num)
Case 0x61
$Num = $Num & '1'
GUICtrlSetData($Label2, $Num)
Case 0x62
$Num = $Num & '2'
GUICtrlSetData($Label2, $Num)
Case 0x63
$Num = $Num & '3'
GUICtrlSetData($Label2, $Num)
Case 0x64
$Num = $Num & '4'
GUICtrlSetData($Label2, $Num)
Case 0x65
$Num = $Num & '5'
GUICtrlSetData($Label2, $Num)
Case 0x66
$Num = $Num & '6'
GUICtrlSetData($Label2, $Num)
Case 0x67
$Num = $Num & '7'
GUICtrlSetData($Label2, $Num)
Case 0x68
$Num = $Num & '8'
GUICtrlSetData($Label2, $Num)
Case 0x69
$Num = $Num & '9'
GUICtrlSetData($Label2, $Num)
Case 0x41
GUICtrlSetData($Label1, 'A')
Case 0x42
GUICtrlSetData($Label1, 'B')
Case 0x43
GUICtrlSetData($Label1, 'C')
Case 0x44
GUICtrlSetData($Label1, 'D')
Case 0x45
GUICtrlSetData($Label1, 'E')
Case 0x51
GUICtrlSetData($Label1, 'Q')
Case 0x52
GUICtrlSetData($Label1, 'R')
Case 0x57
GUICtrlSetData($Label1, 'W')
Case 0x58
GUICtrlSetData($Label1, 'X')
Case 0x5A
GUICtrlSetData($Label1, 'Z')
Case 0x20
GUICtrlSetData($Label2, '')
GUICtrlSetData($Label1, '')
$Num = ''
Case 0x0D
If GUICtrlRead($Label1) <> '' And GUICtrlRead($Label2) <> '' Then GUICtrlSetData($Label3, '你的下单为:'&GUICtrlRead($Label1) & GUICtrlRead($Label2))
;判断GUICtrlRead($Label1) & GUICtrlRead($Label2)即可执行相应的下单
$Num = ''
EndSwitch
EndFunc ;==>WM_HOTKEY
拓展(键盘对应码):