Microsoft DirectX 9.0

Step 5: Gaining Access to the Keyboard

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

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

if (g_lpDIDevice) g_lpDIDevice->Acquire(); 

Now that your application has acquired access to the keyboard, go to Step 6: Retrieving Data from the Keyboard.

© 2002 Microsoft Corporation. All rights reserved.