DirectInput Tutorials

This section contains four tutorials, each providing step-by-step instructions for implementing basic DirectInput functionality.

·Tutorial 1: Using the Keyboard

The first tutorial shows how to add DirectInput keyboard support to an existing application.

·Tutorial 2: Using the Mouse

The next tutorial takes you through the steps of providing DirectInput mouse support in an application. The tutorial is based on the sample application Scrawl, included in the DirectX code samples under the Platform SDK References, and focuses on buffered data.

·Tutorial 3: Using the Joystick

This tutorial shows how to enumerate all the joysticks connected to a system, how to create and initialize DirectInputDevice objects for each of them in a callback function, and how to retrieve immediate data. Sample code is from the Space Donuts application, included in the DirectX code samples in the Platform SDK.

·Tutorial 4: Using Force Feedback

The final tutorial illustrates the creation and manipulation of a simple effect on a force feedback joystick.

Additional sample code can be found in the Samples folder of the DirectX code samples in the Platform SDK References. The Diex1 through Diex4 programs are simple examples of how to read mouse and keyboard data. The Diff1 program shows how to use force feedback in a very simple way.