Keyboard Data

As far as DirectInput is concerned, the keyboard is not a text input device but a game pad with many buttons. When your application requires text input, don't use DirectInput methods; it is far easier to retrieve the data from the normal Windows messages, where you can take advantage of services such as character repeat and translation of physical keys to virtual keys. This is particularly important for languages other than English, which may require special translation of key presses.

To set up the keyboard device for data retrieval, you must first call the IDirectInputDevice::SetDataFormat method with the c_dfDIKeyboard global variable as the parameter. (See Device Data Formats.)

The following sections give more information about obtaining and interpreting keyboard data.