To set up the mouse device for data retrieval, first call the IDirectInputDevice8::SetDataFormat method with the c_dfDIMouse global variable as the parameter value. Use c_dfDIMouse2 if you want to support more than four mouse buttons.
For maximum performance in a full-screen application, set the cooperative level to DISCL_EXCLUSIVE | DISCL_FOREGROUND. Note that the exclusive setting causes the Microsoft Windows cursor to disappear. The DISCL_FOREGROUND setting causes the application to lose access to the mouse when you switch to a debugging window. Changing to DISCL_BACKGROUND enables you to debug the application more easily, but at a cost in performance.
The following sections give more information about retrieval and interpretation of immediate and buffered mouse data.