My idea was to test if the notebook has, hardware-wise, a NumPad or not:
CheckKeyboard proc
LOCAL bytes, rid:RID_DEVICE_INFO, devs[100]:RAWINPUTDEVICELIST
m2m rid.cbSize, RID_DEVICE_INFO
push 127
mov eax, esp
invoke GetRawInputDeviceList, addr devs, eax, RAWINPUTDEVICELIST
pop ecx
For_ ebx=0 To eax-1
imul ecx, ebx, RAWINPUTDEVICELIST
.if devs.dwType[ecx]==RIM_TYPEKEYBOARD
m2m bytes, RID_DEVICE_INFO
push ecx
invoke GetRawInputDeviceInfo, devs.hDevice[ecx], RIDI_DEVICEINFO, addr rid, addr bytes
pop ecx
Print Str$("\n## %i keys", rid.keyboard.dwNumberOfKeysTotal)
Print Str$("\ndwType \t%i", rid.keyboard.dwType)
Print Str$("\ndwSubType\t%i", rid.keyboard.dwSubType)
Print Str$("\ndwNumberOfFunctionKeys\t%i", rid.keyboard.dwNumberOfFunctionKeys)
Print Str$("\ndwNumberOfIndicators\t%i", rid.keyboard.dwNumberOfIndicators)
Print Str$("\ndwKeyboardMode\t%i\n", rid.keyboard.dwKeyboardMode)
.endif
Next
ret
CheckKeyboard endp
Full source & exe attached. The problem: My two notebooks report 101 keys, and all the rest is also identical:
## 101 keys
dwType 81
dwSubType 0
dwNumberOfFunctionKeys 12
dwNumberOfIndicators 3
dwKeyboardMode 1
## 101 keys
dwType 4
dwSubType 0
dwNumberOfFunctionKeys 12
dwNumberOfIndicators 3
dwKeyboardMode 1
But only one does have a real, physical NumPad, the other one has only a NumLock key that makes u i o behave like 4 5 6 etc.
Any ideas?
My notebook does have a number pad, are these the results you expect?:
## 101 keys
dwType 7
dwSubType 0
dwNumberOfFunctionKeys 12
dwNumberOfIndicators 3
dwKeyboardMode 1
Thanks, Michael.
Yes, looks very similar to mine (I wonder why I got two of them, for both notebooks ::))
I had hoped to see a difference in the total number of keys, but apparently the virtual "Fn" keys are added to the physical key count, so numpad or not, you get the same results. It's opaque to the programmer :(
mov answer, input("Does your laptop have a separate NumPad?")
:biggrin:
That is indeed the only solution, it seems. Incredible that there is no numpad detector among the many thousand Windows API functions :(