To retrieve the current state of the mouse, call IDirectInputDevice::GetDeviceState with a pointer to a DIMOUSESTATE structure. The mouse state returned in the structure includes axis data and the state of each of the buttons.
The first three members of the DIMOUSESTATE structure hold the axis coordinates. (See Interpreting Mouse Axis Data.)
The rgbButtons member is an array of bytes, one for each of four buttons. Generally the first element in the array is 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.