Microsoft DirectX 8.1 (Visual Basic) |
Retrieves buffered data from the device.
object.GetDeviceData( _ deviceObjectDataArray() As DIDEVICEOBJECTDATA, _ flags As CONST_DIDGDDFLAGS) As Long
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.
DIERR_INPUTLOST |
DIERR_INVALIDPARAM |
DIERR_NOTACQUIRED |
DIERR_NOTBUFFERED |
In the debug version of Microsoft® DirectInput®, if a call is made to DirectInputDevice8.GetDeviceData and the device has been unacquired, then random bytes will be sent to the device data buffer. To make sure you are not using random device data, always check for the DIERR_NOTACQUIRED return code.
Before device data can be obtained, you must set the data format by using the DirectInputDevice8.SetDataFormat method, set the buffer size by using DirectInputDevice8.SetProperty method, and acquire the device by using the DirectInputDevice8.Acquire method. The maximum number of events that the buffer will hold is one less than the buffer size set with the DirectInputDevice8.SetProperty 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 until no more data is returned.
If the buffer overflows, all pending data is lost and the DI_BUFFEROVERFLOW error is raised.