DirectX SDK |
The DirectInputDevice.GetDeviceData method retrieves buffered data from the device.
object.GetDeviceData( _ deviceObjectDataArray() As DIDEVICEOBJECTDATA, _ flags As CONST_DIDGDDFLAGS) As Long
If it succeeds, the method returns the number of buffered data elements actually returned in deviceObjectDataArray.
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 |
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.