Platform SDK: DirectX

Immediate Mouse Data

[C++]

To retrieve the current state of the mouse, call IDirectInputDevice7::GetDeviceState with a pointer to a DIMOUSESTATE or a DIMOUSESTATE2 structure, depending on the data format. The mouse state returned in the structure includes axis data and the state of each of the buttons.

The first three members of the structure hold the axis coordinates. (See Interpreting Mouse Axis Data.)

The rgbButtons member is an array of bytes, one for each of four or eight buttons. For a traditional mouse, the first element in the array is generally the left button, the second is the right button, and the third is the middle button. The high bit is set if the button is down, and clear if the button is up or not present.

[Visual Basic]

To retrieve the current state of the mouse, call DirectInputDevice.GetDeviceStateMouse, passing in a DIMOUSESTATE type. The mouse state returned in the type includes axis data and the state of each of the buttons.

The x, y, and z members of the DIMOUSESTATE type hold the axis coordinates. (See Interpreting Mouse Axis Data.) The buttons member is an array of bytes, one for each of four buttons. The first element in the array is generally the left button, the second is the right button, the third is the middle button, and the fourth is any other button. The high bit is set if the button is down, and clear if the button is up or not present.

See also

Buffered and Immediate Data