Is it possible to programmatically prevent a game from pausing when its window loses focus?
Asked Answered
C

1

6

I'm playing Skyrim in windowed mode and I am trying to create a bot for this game for personal use. I would like to have the bot play the game in the background, while I do other things, the only problem is that the game window pauses when it loses focus. Is there a way to make the Skyrim process think that it still has the focus, so it continues to run while I do something else on another window? I'm not a windows programming expert but would this be possible if I could somehow intercept the message that says unfocused or minimized to the process, and thus let the process think its still focused?

Cousin answered 10/4, 2012 at 15:3 Comment(3)
You should probably ask this here: gamedev.stackexchange.comUnrestraint
@c0d3Junk13 - Sorry about that, I was looking for the gaming site on stack exchange - I found this one - gaming.stackexchange.com - and thought that was it. I'll try at gamedev thanks.Cousin
I think it is equally OK here, this is not specific to games necessarily.Gigantic
P
6

It's possible. You need to find the mechanism through which the game checks whether it's in the foreground then trick it into thinking the switch has not occurred. This will require a certain amount of reverse engineering on your part. There are many different ways that this checking can actually be done by the game.

You can try to play with hooking one of the following messages/functions: WM_KILLFOCUS, WM_ACTIVATE, GetForegroundWindow. On the other hand, the game might be doing something funky with DirectX. I don't have much experience there.

To re-iterate, to do this properly you are really going to have to find out exactly how the game does the checking (and then subvert that).

Publicness answered 10/4, 2012 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.