Sign in to follow this  

What term/topic and I looking for?

This topic is 2811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Need more information. If you mean by "send input" that you want to inject keystrokes and mouse events to the foreground process from a background process you can do this with the API call SendInput(), although I think Microsoft might have crippled this call under Vista and later. As for receiving input, I'm not sure what you mean. Depending on what you mean you might be talking about installing a global hook, like the low-level keyboard hook, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon88
If by "input" you mean keyboard and mouse state, I believe DirectInput allow you to get that information while your window is not in focus. I haven't ever used it though.


Hmm, that sounds like a viable option but I think I'm looking for something else.

I'll try to explain it further:

I wrote a game in C++ and I'm trying to figure out how to write a program that loads my game and plays it for me and tests it without being in focus (possibly when minimized, too).

This way I can do testing and still use my computer for other purposes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Toolmaker
You are looking for Keyboard Hooking.


Is there a Mouse Hook as well?

Quote:
Could you clarify what kind of thing you want to monitor in the other program?


I would like to get pixel information but I'm assuming I can do that with the keyboard hook?

Also, I'd like to analyze memory but that part is easy.

Share this post


Link to post
Share on other sites
Quote:
Original post by Hardcharger
I wrote a game in C++ and I'm trying to figure out how to write a program that loads my game and plays it for me and tests it without being in focus (possibly when minimized, too).

This way I can do testing and still use my computer for other purposes.


So it's a windowed game, not fullscreen exclusive? Even in this case, you're not going to be able to use SendInput(), or anything else, to inject input events if it is minimized or even just not it focus. When you type on the keyboard Windows sends the events to the child window (of the active window of the foreground process) that has keyboard focus, period.

I mean you could use some kind of interprocess communication -- maybe something as simple as SendMessage-ing a custom message -- but that just begs the question of why you want to drive the testing with a separate process. Since you wrote the game, couldn't you just do whatever you want to do testing-wise in the application itself? -- and just #ifdef this code out if a special preprocessor flag isn't defined.

Share this post


Link to post
Share on other sites
Quote:
Original post by jwezorek
Quote:
Original post by Hardcharger
I wrote a game in C++ and I'm trying to figure out how to write a program that loads my game and plays it for me and tests it without being in focus (possibly when minimized, too).

This way I can do testing and still use my computer for other purposes.


couldn't you just do whatever you want to do testing-wise in the application itself? -- and just #ifdef this code out if a special preprocessor flag isn't defined.


From the information I've received so far and further google searches, the program I write for testing injects code and handles the keyboard and mouse hooks. Adding the testing inside of the game code would be more of a hassle as I'd have to remove it before distributing it. The users could basically "bot" if I allowed this to be released

Share this post


Link to post
Share on other sites

This topic is 2811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this