This sample illustrates the use of a custom data format.
Source: | (SDK root)\Samples\C++\DirectInput\CustomFormat |
Executable: | (SDK root)\Samples\C++\DirectInput\Bin\CustomFormat.exe |
After you have started the sample, the sample displays the mouse location and which mouse button is clicked.
Note If your mouse has more than four buttons, not all of the buttons will be used by this sample.
The comments in CustomFormat.cpp explain how to create, initialize, and retrieve data with a custom data format. You might want to use a custom data format for adding support for a non-standard input device. By enumerating the device objects, you can determine exactly what data is available. The data format you create specifies how the data you are interested in will be stored.
For compatibility, this sample creates a new format to store mouse data. Usually, you would want to use one of the provided c_dfDIMouse types, but the steps taken to create the custom format will be the same for any hardware device. For more information, see IDirectInputDevice8::SetDataFormat.