Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 558
user836045 Avatar asked Apr 10 '12 15:04

user836045


1 Answers

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).

like image 145
Mike Kwan Avatar answered Sep 28 '22 01:09

Mike Kwan