How do you know if the player is using gamepad or keyboard?

Hi All! What’s a good way to know if players are using gamepad or keyboard? I want to perform different logic by judging which input device the player is using. For example, when the player uses keyboard, some logic will be executed; when the player uses gamepad, other logic will be executed.Thanks!…itching-widget

Is Keyboard Key
Is Gamepad Key

Thank you!!

Guys, anybody knows how to make this in C++?