1

This is not for some sort of botting program. I am not looking for any hacks that can get past the Warden on World of Warcraft or any similar games. The game I want to try this on is a single player RPG. I am not very experienced with programming in Windows and was wondering how could I get a program to play a PC game in the background, while I do other things on that same PC at the same time. The game involves the use of the mouse and the keyboard. If I'm using the computer while a program is also trying to use the mouse and keyboard, that would cause problems, I think. This is assuming, of course, that the method to send keyboard and mouse inputs to the game via a program will need to hijack the the mouse and keyboard somehow, if that is even possible.

Is it possible then, to send keyboard and mouse input to that game? The game would mostly be in the background.

2 Answers 2

1

3 choices of which I am aware

1) Use SendKey and the related functions. They can get confused and send input to the wrong place

2) Use AutoHotKey to script what you're trying to do.

3) Steal the code from AutoHotKey that does a better job than SendKey

Sign up to request clarification or add additional context in comments.

2 Comments

I am aware of SendKeys and a similar one is SendInput, but these two do not work on inactive windows. Does AutoHotKey work on windows that are not active?
Alright, that's really good to know. I was thinking I am going to have to write some sort of wrapper program that intercepts between windows and the game. Cheers.
0

You can't send keyboard events to background process. You should bring it to front, AttachThreadInput to it, and simulate key press events. As for mouse input, it may work with backgound process, but it depends on the process specifics, and I suppose that a gaming software will not work with mouse events while it's in backgound as well.

2 Comments

Not even with dll-injection? Is windows configured in such a way that only the active window can ever receive input?
Yes, this is a Windows limitation by design. I suppose a window subclassing (by means of an injected dll) could work in some cases, but in general this is problematic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.