?/TD>
Microsoft DirectX 9.0

Tutorial 1: Using the Keyboard


To prepare for keyboard input, first create an instance of a Microsoft?DirectInput?object. You then use the IDirectInput8::CreateDevice method to create an instance of an IDirectInputDevice8 interface. The IDirectInputDevice8 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 Sample Function 1: DI_Init. Another function, Sample Function 2: DI_Term, is called whenever the system needs to be closed down. Much of the content of these functions are reused in subsequent tutorials.



© 2002 Microsoft Corporation. All rights reserved.