I'm using part of script for keyboard betection between keyboard and numeric pad.
Here's code:
Code: Select all
KeyChk:
#NoEnv
SetBatchLines -1
OnMessage(0xFF, "InputHandler")
RegisterRawInputDevices(1, 6)
InputHandler(wParam, lParam) {
static RID_INPUT := 0x10000003
static RIDI_DEVICENAME := 0x20000007
Critical
DllCall("GetRawInputData"
, "Ptr", lParam
, "UInt", RID_INPUT
, "Ptr", 0
, "UIntP", size
, "UInt", 8 + A_PtrSize * 2)
VarSetCapacity(buffer, size)
DllCall("GetRawInputData"
, "Ptr", lParam
, "UInt", RID_INPUT
, "Ptr", &buffer
, "UIntP", size
, "UInt", 8 + A_PtrSize * 2)
devHandle := NumGet(buffer, 8)
vk := NumGet(buffer, 8 + 2 * A_PtrSize + 6, "UShort")
DllCall("GetRawInputDeviceInfo"
, "Ptr", devHandle
, "UInt", RIDI_DEVICENAME
, "Ptr", 0
, "UIntP", size)
VarSetCapacity(info, size)
DllCall("GetRawInputDeviceInfo"
, "Ptr", devHandle
, "UInt", RIDI_DEVICENAME
, "Ptr", &info
, "UIntP", size)
GotInfo := StrGet(&info)
StringMid, GotID, GotInfo, 13 , 3
if GotID =1A2
{
KB =Inland
}
Else if GotID =1C4
{
KB =Keypad
}
Else if GotID =05A
{
KB =Wireless
}
Else if GotID =04F
{
KB =Japanese
}
Else if GotID =13B
{
KB =Dell PS/2
}
Else if GotID =030
{
KB =Adesso
}
Else
{
KB = %GotInfo%
}
;ToolTip % "`keyboard:`t" KB
; . "`nscancode vk:`t" vk
; . "`npressed:`t`t" A_TickCount
}
return
Code: Select all
If KB =Keypad
{
if vk =8 ; Keypad Backspace sc00e
{
Send, {LCtrl Down}{z 1}{LCtrl Up}
Send, {Raw}*
return
}
Else if vk =9 ; Keypad Tabulator sc00f
{
Gosub, Tabulator
return
}
Else if vk =235 ; Keypad NumLock sc045 (remapped to NoConvert vkEBsc07B)
{
Send, {Raw}e
return
}
}
If KB =Adesso
{
if vk =8 ; Keyboard Backspace sc00e
{
;Send, {sc00e 1)
return
}
Else if vk =9 ; Keyboard Tabulator sc00f
{
return
}
Else if vk =235 ; Keyboard NumLock sc045 (remapped to NoConvert vkEBsc07B)
{
Send, {Raw}¢
return
}
}
KeyPad:
Code: Select all
Else if vk =235 ; Keypad NumLock sc045 (remapped to NoConvert vkEBsc07B)
{
Send, {Raw}e
return
}
Code: Select all
Else if vk =235 ; Keyboard NumLock sc045 (remapped to NoConvert vkEBsc07B)
{
Send, {Raw}¢
return
}
These keys are no handled in whole script, only in code above.
Thank you for each help, reply or comment.
Miro