Поделиться через


DIDEVICEOBJECTDATA Structure

Contains buffered device information. This structure is used with the IDirectInputDevice8::GetDeviceData and the IDirectInputDevice8::SendDeviceData methods.

Syntax

typedef struct DIDEVICEOBJECTDATA {
    DWORD dwOfs;
    DWORD dwData;
    DWORD dwTimeStamp;
    DWORD dwSequence;
    UINT_PTR uAppData;
} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA;

Members

  • dwOfs
    For IDirectInputDevice8::GetDeviceData, the offset into the current data format of the object whose data is being reported; that is, the location in which the dwData would have been stored if the data had been obtained by a call to the IDirectInputDevice8::GetDeviceState method. If the device is accessed as a mouse, keyboard, or joystick, the dwOfs member is one of the mouse device constants, keyboard device constants, or joystick device constants. If a custom data format has been set, it is an offset relative to the custom data format.

    For IDirectInputDevice8::SendDeviceData, the instance ID of the object to which the data is being sent, as obtained from the dwType member of a DIDEVICEOBJECTINSTANCE structure.

  • dwData
    Data obtained from or sent to the device.

    For axis input, if the device is in relative axis mode, the relative axis motion is reported. If the device is in absolute axis mode, the absolute axis coordinate is reported.

    For button input, only the low byte of dwData is significant. The high bit of the low byte is set if the button was pressed; it is clear if the button was released.

  • dwTimeStamp
    System time at which the input event was generated, in milliseconds. This value wraps around approximately every 50 days. See Remarks.

    When the structure is used with the IDirectInputDevice8::SendDeviceData method, this member must be 0.

  • dwSequence
    DirectInput sequence number for this event. All input events are assigned an increasing sequence number. This enables events from different devices to be sorted chronologically. Because this value can wrap around, care must be taken when comparing two sequence numbers. The DISEQUENCE_COMPARE macro can be used to perform this comparison safely.

    When the structure is used with the IDirectInputDevice8::SendDeviceData method, this member must be 0.

  • uAppData
    Application-defined action value assigned to this object in the last call to IDirectInputDevice8::SetActionMap. This is the value in the uAppData member of the DIACTION structure associated with the object. Ignore this value if you are not using action mapping.

    When the structure is used with the IDirectInputDevice8::SendDeviceData method, this member must be zero.

Remarks

The system time returned in dwTimeStamp comes from the same clock used by the Microsoft Win32 GetTickCount or timeGetTime functions, but it produces potentially more precise values. For example, on Microsoft Windows 95, the GetTickCount timer is updated only every 55 milliseconds, but the dwTimeStamp value is accurate to within 1 millisecond. Therefore, if you call GetTickCount and it returns n, and you then receive an event with a timestamp of n + n1, you cannot assume that the event took place exactly n1 milliseconds after the call to GetTickCount.