9

So far I've been capable of using SendInput() function to simulate mouse and keyboard virtual keys and scan keys using MOUSEINPUT and KEYBDINPUT.

I read (on S.O) that INPUT_HARDWARE is for other devices rather than the mouse or keyboard. I'm trying to simulate an Xbox controller (or any controller, if that might help) input using SendInput() and the HARDWAREINPUT structure. Is it possible to do so? How to do it properly?

Community
  • 1
  • 1
Vinícius
  • 15,498
  • 3
  • 29
  • 53

1 Answers1

0

According to the leaked WinXP source code INPUT_HARDWARE event type is not supported at all by SendInput on a system level after Win98:

case INPUT_HARDWARE:
            if (fCanDiscontinue) {
                /*
                 * Not supported on NT.
                 */
                RIPERR0(ERROR_CALL_NOT_IMPLEMENTED, RIP_WARNING, "xxxSendInput: INPUT_HARDWARE is for 9x only.");
                goto discontinue;
            }
            break;

According to Wine source code it seems it was used in some old code for HID device support.

I trying to simulate an Xbox controller (or any controller, if that might help) input using SendInput() and the HARDWAREINPUT structure.

Better try to use Virtual Gamepad Emulation Framework (ViGEmBus) for this. It can emulate XInput controllers and is battle tested.

DJm00n
  • 1,083
  • 5
  • 18