Tutorial 1: Using the Keyboard

To prepare for keyboard input, first create an instance of a DirectInput object. You then use the IDirectInput8::CreateDevice method to create an instance of an IDirectInputDevice8 Interface interface. The IDirectInputDevice8 Interface interface methods are used to manipulate the device, set its behavior, and retrieve data.

This tutorial divides the required tasks into the following steps.

All of the tutorial steps are illustrated by code fragments within the text. All related steps for initializing the system are gathered in Tutorial 1 Samples. Another function, Tutorial 1 Samples, is called whenever the system needs to be closed down. Much of the content of these functions are reused in subsequent tutorials.