2

Does the XInput library feature support for handling events from connected keyboards and mice?

I know it supports handling events from xInput compatible controllers but it wasn't clear whether keyboard and mouse input handling is also included. I don't see anything on the MSDN XInput page about supporting it so I don't think so but I want to make sure. So if I wanted to enable control for a piece of software for a user using either an XInput compatible controller or a mouse and keyboard would I need to handle mouse and keyboard events separately using the Windows Message system while handling controller input using XInput?

Thanks for any feedback!

Nathan Blair
  • 943
  • 13
  • 21

1 Answers1

1

XInput is only for gamepads, and is deprecated on windows 10 for the new IGamepad interface

For keyboards and mice, you are looking for raw input. It works with windows messaging, but allow you to poll events at a low level, to make use of high DPI devices, higher polling rate and no windows desktop acceleration system.

galop1n
  • 8,573
  • 22
  • 36
  • Thanks for that information. I was not aware of the IGamePad so I will look into that as opposed to XInput. I'm targeting Windows 10 anyway so it should be okay. Raw Input does seem like more along the lines of what I'm looking for keyboard and mouse devices. – Nathan Blair Jul 03 '16 at 18:03
  • Where did you read that XInput would be deprecated in favor of IGamepad? As far as I'm aware, IGamepad is managed runtime only, so native C++ still has to rely on XInput. or did I miss something? – Mario Jul 15 '16 at 08:36
  • @Mario it is deprecated because they don't port new feature back to it, like the trigger force feedback of the xbox one controller or the xbox user association. You can use IGamepad without the managed runtime in a pure native fashion, it is a little awkward and documentation is bad on this. I use it that way because the managed runtime is not compatible with c++ exception and it is a no go for me. – galop1n Jul 16 '16 at 06:32
  • It's not deprecated. You can use XInput v9.1 works perfectly. – KeyC0de Jan 06 '21 at 11:06
  • 1
    DirectInput is deprecated/obsoleted/legacy. xInput is the 'new'(6yr old) standard with V1.4 being shipped with windows 10. GameInput is the 'new, new' standard... FRom MSFT: GameInput is a functional superset of all legacy input APIs—XInput, DirectInput, Raw Input, Human Interface Device (HID), and WinRT APIs – Reahreic Jun 06 '22 at 13:07