How Can I access my Keyboard using DirectX?
To access the keyboard, the following six steps are essential/*Initialization*/
1. Creating the DirectInput Object DirectInput8Create function call 2. Creating the DirectInput Keyboard Device by CreateDevice function call from the DI object. 3. Setting the Keyboard Data Format by the SetDataFormat function call from the KB Device. 4. Setting the Keyboard Behavior by the SetCooperativeLevel function call from the KB Device. 5. Gaining Access to the Keyboard by the Acquire function call from KB Device./*ReadKeyBoardInput*/
6. Retrieving Data from the Keyboard by the GetDeviceState function call from the KB Device./*Cleanup*/
7. Closing Down the DirectInput System by the UnAcquire function call from the KB Device and then freeing the KBDevice and the DI Object.The following "KeyBoard.zip" example creates a DirectInput Object, then creates a KeyBoard Device from DI object, Reads Left/Right Arrow KeyPress from it and uses it rotate a Triangle. Also at the end of message pumping it Releases the KeyBoard device and the DI object
FAQ Menu
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
