想用DllCll 得到USB键盘的句柄 ,不知道怎么写
PS2 键盘的
如下Global $DDD_RAW_TARGET_PATH = 1
Global $DDD_REMOVE_DEFINITION = 2
Global $KEYBOARD_INDICATOR_PARAMETERS="ushort UnitId;ushort LedFlags;"
Global $IOCTL_KEYBOARD_SET_INDICATORS = 720904
Global $IOCTL_KEYBOARD_QUERY_INDICATORS = 720960
; Flags to _KeyboardSetLed
Global $KEYBOARD_LIT = 0
Global $KEYBOARD_UNLIT = 8
Global $KEYBOARD_SCROLL_LED = 1
Global $KEYBOARD_NUM_LED= 2
Global $KEYBOARD_CAPS_LED = 4
; #FUNCTION# ====================================================================================================================
; Name...........: _OpenKeyboard
; Description ...: Opens a handle to the keyboard
; Syntax.........: _OpenKeyboard()
; Parameters ....: None
; Return values .: None
; Author ........: Andreas Karlsson (monoceres)
; Modified.......:
; Remarks .......:
; Related .......: _CloseKeyboard
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _OpenKeyboard()
Local $KeyboardHandle
DllCall("Kernel32.dll","int","DefineDosDeviceW","dword",$DDD_RAW_TARGET_PATH,"wstr","Keybd","wstr","\Device\KeyboardClass0")
$KeyboardHandle = DllCall("Kernel32.dll","hwnd","CreateFile","str","\\.\Keybd","dword",0x40000000,"dword",0,"dword",0,"dword",3,"dword",0,"dword",0)
$KeyboardHandle=$KeyboardHandle[0]
Return $KeyboardHandle
EndFunc
详细请移步
http://www.autoitx.com/forum.php ... =%BC%FC%C5%CC%B5%C6 |