我将如何模拟对非活动窗口的直接输入? [英] How would i go about simulating direct input to an inactive window?

查看:72
本文介绍了我将如何模拟对非活动窗口的直接输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将直接输入发送到python中的一个(可能)非活动窗口.到目前为止,我已经找到了一个解决方案可以通过ctypes和我有一种模拟窗口输入的解决方案,不适用于某些游戏,因为我正在测试的游戏(GTA V)使用直接输入,并通过使用 postMessage()="https://pypi.org/project/pywin32/" rel ="nofollow noreferrer"> py32win .

I want to send direct input to a (possibly) inactive window in python. So far i have found a solution to send direct input via ctypes and i have a solution to simulate input to a window, which doesn't work with some games as the one i am testing with (GTA V) is using direct input, using postMessage()via py32win.

那么,当目标窗口可能处于不活动状态时,我现在将如何模拟那些直接输入?这有可能吗?

So how would i now go about simulating those direct inputs while the target window is possibly not active? Is this even possible?

我认为应该这样,因为例如AutoHotkey可以在这种情况下直接发送邮件.

I would think it should be, because AutoHotkey for example can manage to send direct in such a case.

如果您想尝试一下自己的话,我可以提供postMessage()版本,否则,我想保持问题代码的自由.

If you would like to experiment yourself i can provide the postMessage() version, otherwise i would like to keep the question code-free.

推荐答案

据我所知您不能这样做.解决方法(位于 https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/)是

As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be

  • 在计算机上获取VM
  • 将游戏和脚本加载到虚拟机上
  • 运行游戏,并使您的脚本与活动窗口互动(在VM上)
  • 最小化主机的VM窗口

这篇关于我将如何模拟对非活动窗口的直接输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆