To set up the joystick device for data retrieval, first call the IDirectInputDevice::SetDataFormat method with the c_dfDIJoystick or c_dfDIJoystick2 global variable as the parameter. (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 IDirectInputDevice2::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 flight yoke: