Microsoft DirectX 8.1 (C++) |
Retrieves immediate data from the device.
HRESULT GetDeviceState( DWORD cbData, LPVOID lpvData );
If the method succeeds, the return value is DI_OK.
If the method fails, the return value can be one of the following error values:
DIERR_INPUTLOST |
DIERR_INVALIDPARAM |
DIERR_NOTACQUIRED |
DIERR_NOTINITIALIZED |
E_PENDING |
Before device data can be obtained, set the cooperative level by using the IDirectInputDevice8::SetCooperativeLevel method, then set the data format by using IDirectInputDevice8::SetDataFormat, and acquire the device by using the IDirectInputDevice8::Acquire method.
The five predefined data formats require corresponding device state structures according to the following table:
Data format | State structure |
---|---|
c_dfDIMouse | DIMOUSESTATE |
c_dfDIMouse2 | DIMOUSESTATE2 |
c_dfDIKeyboard | array of 256 bytes |
c_dfDIJoystick | DIJOYSTATE |
c_dfDIJoystick2 | DIJOYSTATE2 |
For example, if you passed the c_dfDIMouse format to the IDirectInputDevice8::SetDataFormat method, you must pass a DIMOUSESTATE structure to the IDirectInputDevice8::GetDeviceState method.
Windows NT/2000/XP: Requires Windows® 2000.
Windows 98/Me: Requires Windows 98 or later. Available as a redistributable for Windows 98.
Header: Declared in Dinput.h.
IDirectInputDevice8::Poll, Polling and Event Notification, Buffered and Immediate Data