capture joystick extra buttons

1.2k Views Asked by At

Could someone please tell me if there is a way to capture extra joystick buttons? I mean buttons number 5,6,7,8 and so on.

I use this code to capture button down event :

procedure MMJOY1BUTTONDOWN (var LocMessage: TMMJoyStick); message MM_JOy1BUTTONDOWN;

But the problem is that it just captures the 4 standard buttons, not any extra buttons.

Thanks a lot

1

There are 1 best solutions below

0
On BEST ANSWER

The Multimedia Joystick API does not support generating window messages for buttons 5+, you have to poll their status manually using joyGetPosEx(). Otherwise, you should use DirectInput from the DirectX API instead, as it replaces the older API.

Update: Alternatively, you can use the Raw Input API to receive event notifications directly from the joystick hardware. See CodeProject for more details:

Using the Raw Input API to Process Joystick Input