Joystick Notifications

You can capture direct joystick messages to be sent to a function by using the joySetCapture function. Only one application at a time can capture messages from a joystick, but you can query the joystick from another application by using the joyGetPos or joyGetPosEx function.

Note A joystick message can fail to reach the application that captured the joystick if a second application uses joyGetPos or joyGetPosEx to query the joystick at approximately the same time that the message is sent. In this case, the second application could intercept the message.

If you want to capture messages from two joysticks attached to the system, use joySetCapture twice, once for each joystick. Your window receives separate and distinct messages for each device.

You can release a captured joystick by using the joyReleaseCapture function. If an application does not release the joystick before ending, the joystick is automatically released shortly after the capture window is destroyed.

You cannot capture an unplugged joystick. The joySetCapture function returns JOYERR_UNPLUGGED if the specified device is unplugged.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples