Setting the Data Format

The SetDataFormat function specifies which data format will be used.

The single parameter to this function specifies the device type. For the keyboard, you want to pass the value of c_dfDIKeyboard as this parameter. The constant for a mouse would be c_dfDIMouse. Here, then, is a sample function call:

HRESULT result = dikeyboard->SetDataFormat(&c_dfDIKeyboard);

Note that you do not need to define c_dfDIKeyboard yourself; it is defined in dinput.h.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset