'Using an USB keypad to control my application Windows

I have a Windows machine with an USB keypad attached to it. I would like to use the keypad to control my application. Ideally I would like to detach the keypad from the system and detecting the keypresses in my program.

On Linux I remove the keypad from the input by

xinput disable 20

20 being the keypad device number. Then I can communicate with the keypad directly using hidapi:

hid.hidapi.hid_init()
device = hid.hidapi.hid_open_path(path)
buf = bytes([0]*65)
hid.hidapi.hid_read_timeout(device, buf, len(buf), 250)

path being the device's path. Could I detach the keyboard from the system and use it as my device? If not is there a way to write a driver specifically for my keypad (vid/pid) that could communicate with my program? I am looking for swift solutions like the above hidapi script and nod GOD tutorials about Windows Drivers.

Thank You in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source