DirectX SDK

Joystick Data

[C++]

To set up the joystick device for data retrieval, first call the IDirectInputDevice7::SetDataFormat method with the c_dfDIJoystick or the c_dfDIJoystick2 global variable as the parameter value. (See Device Data Formats.)

Because some device drivers do not notify DirectInput of changes in state until explicitly asked to do so, you should always call the IDirectInputDevice7::Poll method before attempting to retrieve data from the joystick. For more information, see Polling and Events.

[Visual Basic]

To set up the joystick device for data retrieval, first call the DirectInputDevice.SetCommonDataFormat method with DIFORMAT_JOYSTICK or DIFORMAT_JOYSTICK2 as the parameter value. (See Device Data Formats.)

Because some device drivers do not notify DirectInput of changes in state until explicitly asked to do so, you should always call the DirectInputDevice.Poll method before attempting to retrieve data from the joystick. For more information, see Polling and Events.

The following sections cover getting and interpreting data from a joystick or other similar input device, such as a game pad or steering wheel: