[英]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.我在窗口模式下玩 Skyrim,我正在尝试为这个游戏创建一个供个人使用的机器人。 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.
我想让机器人在后台玩游戏,而我做其他事情,唯一的问题是游戏 window 在失去焦点时暂停。 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?
有没有办法让 Skyrim 进程认为它仍然有焦点,所以当我在另一个 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?
我不是 windows 编程专家,但如果我能以某种方式截获对流程不专心或最小化的消息,从而让流程认为它仍然专注,这是否可能?
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 .您可以尝试挂接以下消息/函数之一: WM_KILLFOCUS 、 WM_ACTIVATE 、 GetForegroundWindow 。 On the other hand, the game might be doing something funky with DirectX.
另一方面,游戏可能会使用 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).重申一下,要正确地做到这一点,您真的必须准确地找出游戏是如何进行检查的(然后颠覆它)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.