Not being able to understand the C/C++ language will be a major impediment to understanding the sample code that I posted a link to.
To put a question back in the OP's court:
What drives the need to know which keyboard was used to generate a key press event?
As far as Windows is concerned, it doesn't specifically care which device generated the event, and it abstracts the low-level interaction with a keyboard device so that applications are made aware of the key press event regardless of which device generated it.