DirectX SDK

Step 5: Gain Access to the Keyboard

[Visual Basic]

The information in this topic pertains only to applications written in C++. See DirectInput Visual Basic Tutorials.

[C++]

After your application sets the keyboard's behavior, it can acquire access to the device by calling the IDirectInputDevice7::Acquire method. The application must acquire the device before retrieving data from it. The Acquire method accepts no parameters.

The following line of code acquires the keyboard device that was created in Step 2: Create the DirectInput Keyboard Device:

if (g_lpDIDevice) g_lpDIDevice->Acquire(); 

Next: Step 6: Retrieve Data from the Keyboard