有没有办法向单独程序提供伪造的I/O信息?
例如,我想在窗口中的特定位置上单击鼠标,但是我不希望我的真实光标移动或做任何事情。 有可能的解决方案吗?
更具体地说,我想在特定的窗口上进行一些鼠标操作,但是如果没有我的光标,我确实可以这样做,这使我可以用鼠标正常做其他事情。只有目标窗口才知道自身被单击,即使窗口被最小化。
我知道使用setCursorPos()
,pyautogui.moveto()
或其他东西,使用setCursorPos()
或sothing非常容易使用一些代码。但是我什么也没做!
我能想到的唯一方法是使用虚拟机。
For example, I want to simulate a mouse click at a specific position in a window, but I don't want my real cursor to move or do anything.
Is there a possible solution ?
More specifically, I want to do some mouse operations on a specific window, but without my cursor really doing it, which allows me to do other things normally with my mouse. Only the target window knows itself is being clicked, even when the window is minimized.
I know it's really easy use some code to move my cursor, with SetCursorPos()
, pyautogui.moveTo()
or something. But I can't do anything then!
The only way I can think of is to use a virtual machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要将输入发送到活动窗口,则可以通过关注本文。
它使用 inputSimulator 将输入发送到活动窗口。它可作为 nuget package 也是如此。
编辑:
如果您想在不移动自己的光标的情况下发送鼠标事件,那么您可以尝试的是在虚拟机内运行目标程序和C#自动化程序,这样您就可以拥有2个鼠标光标(一个在您的主操作中,另一个在在自动操作系统中)
If you want to send inputs to the active window you can do it by following this article.
It uses InputSimulator to send inputs to active windows. It is available as a Nuget package too.
Edit:
If you want to send mouse events without moving your own cursor, what you could try is running your target program and the C# automation program inside a virtual machine, that way you can have 2 mouse cursors (one in your main OS, and the other in the automated OS)