?
Solved

Sending keystrokes to DirectX applications.

Posted on 2004-08-19
5
Medium Priority
?
644 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 520 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

800 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