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.
Adding DirectInput keyboard support to an application is relatively simple, so this tutorial is not based on the complete Keyboard Sample application. 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.