DirectX SDK

Step 1: Create DirectInput and the Keyboard Device

[C++]

This topic pertains only to application development in Visual Basic. See DirectInput C/C++ Tutorials.

[Visual Basic]

The first step in setting up the DirectInput system is to create a single DirectInput object as overall manager. This is done with a call to the DirectX7.DirectInputCreate method, typically in the Load event handler for the main form or in Sub Main:

Dim dx As New DirectX7
Dim di As DirectInput

Set di = dx.DirectInputCreate()
 

The keyboard is then created as a standard device by passing the keyboard GUID alias to DirectInput.CreateDevice:

Dim didev As DirectInputDevice
Set didev = di.CreateDevice("GUID_SysKeyboard")

Next: Step 2: Set the Keyboard Parameters