Step 2: Setting the Mouse Data Format
Microsoft DirectX 9.0 SDK Update (October 2004)

Step 2: Setting the Mouse Data Format


After retrieving an IDirectInputDevice8 pointer, your application must set the device's data format. For mouse devices, this is a very simple task. Call the IDirectInputDevice8::SetDataFormat method, specifying the data format provided for your convenience by Microsoft DirectInput in the c_dfDIMouse global variable.

The following code fragment attempts to set the device's data format. If the call fails, FALSE is returned.

hr = g_pMouse->SetDataFormat(&c_dfDIMouse);

if (FAILED(hr)) {
    return FALSE;
}

After setting the mouse data format, go to Step 3: Setting the Mouse Behavior.



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.