Partager via


Device Setup

Your application must obtain a DirectInput device object for each device from which it expects input. It must also prepare each device for use, which requires, at the very least, setting the data format and acquiring the device. You might also want to carry out other preparatory tasks such as getting information about the devices and changing their properties.

The following tasks are part of the setup process. Certain steps are always required. Other steps may be necessary if you need further information about devices or need to change default values.

  1. Create the DirectInput device (required). See Creating a DirectInput Device.

  2. Get the device capabilities (optional).

  3. Enumerate the keys, buttons, and axes on the device (optional). See Device Object Enumeration.

  4. Set the cooperative level (highly recommended).

  5. Set the data format (required).

  6. Set the device properties (you must at least set the buffer size if you intend to get buffered data).

  7. When ready to read data, acquire the device (required). See Acquiring Devices.