简体   繁体   English

如何在后台模拟对 DirectX 应用程序的鼠标点击?

[英]How to simulate mouse clicks to a DirectX application in background?

I need to send some mouse clicks to a DirectX application covered by other windows while doing stuffs in the foreground.我需要将一些鼠标点击发送到其他窗口覆盖的 DirectX 应用程序,同时在前台执行操作。 To other applications I uses SendMessage and it works well, however it won't work with DirectX apps.对于其他应用程序,我使用SendMessage并且它运行良好,但是它不适用于 DirectX 应用程序。 SendInput doesn't make sense because it controls your cursor directly and requires the window to be foreground. SendInput没有意义,因为它直接控制您的光标并要求窗口处于前台。 I want it does that completely background.我希望它完全有背景。 Is there a way to achieve this?有没有办法实现这一目标? Thanks!谢谢!

UPDATE 20191226: Just discovered that the Nox Android emulator listens mouse click events on the parent window rather than the rendering window.更新 20191226:刚刚发现 Nox Android 模拟器在父窗口而不是渲染窗口上监听鼠标点击事件。 PostMessage to the parent window solves my problem. PostMessage到父窗口解决了我的问题。

00151044 "NoxAppPlayer" Qt5QWindowIcon                 <--Outmost window
└─ ...
└─ 00151264 "ScreenBoardClassWindow" Qt5QWindowIcon    <--PostMessage mouse event to this window
   └─ 002A05EA "sub" subWin                            <-- Screen renders on this window
└─ ...

Finally I used a completely different method: using ADB provided in Android emulator.最后我使用了一个完全不同的方法:使用 Android 模拟器中提供的 ADB。 Just adb connect to the port which the emulator used and simplly adb shell input tap [x] [y] solves my problem.只需将adb connect到模拟器使用的端口,只需adb connect adb shell input tap [x] [y]解决我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM