Solved

Sending keystrokes to DirectX applications.

Posted on 2004-08-19
5
626 Views
Last Modified: 2008-03-03
I need a way to send keystrokes to a DirectX (3.0+) application.  I've tried Sendkeys, as well as the keybd_event API, no luck, the keystrokes never arrive.

Anyone know?
0
Comment
Question by:fizycist
  • 3
5 Comments
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 11852514
Hmm, I would guess it is using DirectInput, from MSDN
"Microsoft DirectInput Overview
Apart from providing services for devices not supported by the Microsoft Win32 API, Microsoft DirectInput gives faster access to input data by communicating directly with the hardware drivers rather than relying on Microsoft Windows messages."
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 11852705
You might try using the On-Screen keyboard (Under Accessories --> Accessibility)  If you can drive it with On-Screen Keyboard, there is some way to drive it programatically.
0
 

Author Comment

by:fizycist
ID: 11856785
Ok, I tried on screen keyboard.  This game will accept some keystrokes from it, not all.  The keystrokes for movement are not accepted, and these are the ones I need.  I tried remapping the keys in the game, but no luck.

So can I slip keystrokes in with DirectInput?  How?

(btw this is for a neural network demonstration, the goal is to teach a NN to play this simple game (Subspace / Contiuum.  The software can already read the screen and identify objects, but simply cannot act on its decisions, arghh)
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 130 total points
ID: 11901808
I think slipping keystrokes in to DirectInput might be tough.  DirectInput gives the app direct access to the keyboard driver, nothing in Windows interferes while the app is the active app.  Some ideas would be to find a keyboard driver that supports this kind of thing (I don't know if they exist), buy/make a hardware device to slip in between your real keyboard and the computer (the home built flight simulator guys seem to have some experience here, search for keyboard eumulator simulator), maybe you could hook into the calls to DirectInput, catch when they try to capture the keyboard, and thus find their input routine which you could fake key presses into.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 57
VBA open file from excel cell 4 33
Adding to a VBA? 6 48
VBA filters 2 39
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now