Platform SDK: DirectX

DirectInputDevice.GetDeviceData

The DirectInputDevice.GetDeviceData method retrieves buffered data from the device.

object.GetDeviceData( _ 
  deviceObjectDataArray() As DIDEVICEOBJECTDATA, _ 
  flags As CONST_DIDGDDFLAGS) As Long

Parameters

object
Object expression that resolves to a DirectInputDevice object.
deviceObjectDataArray()
Array of DIDEVICEOBJECTDATA types to receive the buffered data.
flags
Flags that control the manner in which data is obtained. This value can be 0 or one of the constants of the CONST_DIDGDDFLAGS enumeration.

Return Values

If it succeeds, the method returns the number of buffered data elements actually returned in deviceObjectDataArray.

Error Codes

If the method fails, an error is raised and Err.Number may be one of the following error codes:

DI_BUFFEROVERFLOW
DIERR_INPUTLOST
DIERR_INVALIDPARAM
DIERR_NOTACQUIRED
DIERR_NOTBUFFERED

Remarks

Before device data can be obtained, you must set the data format by using the DirectInputDevice.SetDataFormat method, set the buffer size by using DirectInputDevice.SetProperty method, and acquire the device by using the DirectInputDevice.Acquire method.

You can use this method to retrieve one or more input events from the buffer you created by using SetProperty. You do not have to retrieve all pending events with a single call. You can, for example, pass in a deviceObjectDataArray() consisting of a single element and loop on GetDeviceData till no more data is returned.

If the buffer overflows, all pending data is lost and the DI_BUFFEROVERFLOW error is raised.

See Also

DirectInputDevice.Poll, Polling and Events