To prepare for keyboard input, you first create an instance of a DirectInput object. Then you use the IDirectInput::CreateDevice method to create an instance of an IDirectInputDevice interface. The IDirectInputDevice interface methods are used to manipulate the device, set its behavior, and retrieve data.
The tutorial breaks down the required tasks into the following steps:
Adding DirectInput keyboard support to an application is relatively simple, so this tutorial is not accompanied by a complete sample application. All of the tutorial steps are illustrated by code within the text. The related steps for initializing the system are gathered in Sample Function 1: DI_Init. Another function, Sample Function 2: DI_Term, is called whenever the system needs to be closed down.