Platform SDK: DirectX

Architectural Overview of DirectInput

[C++]

The basic architecture of a DirectInput implementation consists of the DirectInput object, which supports the IDirectInput7 COM interface, and an object for each input device that provides data. Each device in turn has device object instances or more simply device objects, which are individual controls or switches such as keys, buttons, or axes.

Note  The word object is used to describe both a code object and one of the individual controls on an input device. In this documentation, device object means an input device control, rather than a code object that instantiates the IDirectInputDevice7 interface. Code objects representing whole devices are referred to as DirectInputDevice objects.

Each DirectInputDevice object represents one input device, such as a mouse, keyboard, or joystick. A piece of hardware that is really a combination of different types of input devices, such as a keyboard with a touchpad, can be represented by two or more DirectInputDevice objects. A force-feedback device is represented by a single joystick object that handles both input and output.

DirectInputDevice objects instantiate the IDirectInputDevice7 interface.

The application ascertains the number and type of device objects available by using the IDirectInputDevice7::EnumObjects method. Individual device objects are not encapsulated as code objects, but are described in DIDEVICEOBJECTINSTANCE structures.

Force-feedback effects are represented by the IDirectInputEffect interface. Methods of this interface are used to create, modify, start, and stop effects.

All DirectInput interfaces are available in ANSI and Unicode versions. If "UNICODE" is defined during compilation, the Unicode versions are used.

[Visual Basic]

The basic architecture of a DirectInput implementation consists of a single DirectInput object and a DirectInputDevice object for each input device that is being used by the application. The DirectInputDevice object is used for retrieving the input data.

Any available device, regardless of whether it is being used by DirectInput, can also be represented by a DirectInputDeviceInstance object, which can be used to retrieve miscellaneous information about that device.

Each DirectInputDevice object represents one input device, such as a mouse, keyboard, or joystick. (In this documentation, the term joystick includes all game controllers other than a mouse or keyboard.) A piece of hardware that is really a combination of different types of input devices, such as a keyboard with a touchpad, can be represented by two or more DirectInputDevice objects. A force-feedback device is represented by a single joystick object that handles both input and output.

Each device in turn has device objects, which are individual controls or switches, such as keys, buttons, or axes. Each device object is represented by an instance of the DirectInputDeviceObjectInstance class, whose methods can be used to retrieve information about the device object. (The input data, however, is always retrieved by DirectInputDevice.)

Note  The word object is used to describe both a code object and one of the individual controls on an input device. In this documentation, device object means an input device control, rather than a DirectInputDevice object.

Devices and device objects can be enumerated, and the resulting collections are represented by DirectInputEnumDevices and DirectInputEnumDeviceObjects objects.