应用程序不响应 Windows API 事件? [英] Application not responding to Windows API events?

查看:51
本文介绍了应用程序不响应 Windows API 事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,我想使用 python 自动化 GUI,但我尝试自动化的 Windows 程序不响应 pyautogui 鼠标点击.制作此应用程序的公司是否有可能故意阻止 Windows API 事件?

I was working on a project where I wanted to automate a GUI using python, but the windows program I was trying to automate does not respond to pyautogui mouse clicks. Is it possible that the company that made this application intentionally blocked windows API events?

我尝试自动化的特定程序是 Blackbaud's Raiser's Edge.

The particular program I am trying to automate is Blackbaud's Raiser's Edge.

我之所以这么问是因为我打算用树莓派修改鼠标来控制鼠标点击,如果没有其他解决方法可以解决此问题,然后从我的计算机通过 SSH 连接到它.

I am asking because I am planning on potentially modding a mouse with a raspberry pi to control mouse clicks and then SSH to it from my computer if there is no other work-around for this issue.

推荐答案

Windows 10 使这变得更加困难.如果您尝试自动化的应用程序以管理员身份运行,则您无法使用以普通用户身份运行的程序来控制它.

Windows 10 has made this more difficult. If the application you are trying to automate is running as Admin, you cannot control it with a program running as a regular user.

尝试以管理员身份运行您的 Python 程序.

Try running your python program as administrator.

但是,是的,程序可以区分真实的鼠标事件和模拟的事件.如果是高度敏感的程序,他们可能有.或者,如果是视频游戏,他们可能只是直接轮询硬件而忽略 Windows 消息.

But, yes, it is possible for a program to distinguish between real mouse events and simulated ones. If it is a highly sensitive program, they may have. Or, if it is a video game, they may just poll the hardware directly and ignore windows messages.

此外,许多应用程序想要的不仅仅是点击"消息.他们想要mouseenter/mousemove/mousedown/mouseup.如果您没有发送所有这些消息,则不会激活为单击".pyautogui.click 应该可以正确模拟它,但是如果您对应用程序进行试验并查看它的响应方式(单击鼠标而不释放,会发生什么?)您可能能够改进模拟.也许在 pyautogui.mouseDown() 和 pyautogui.mouseUp() 之间延迟.

Also, many applications want more than a "click" message. They want the mouseenter/mousemove/mousedown/mouseup. If you don't have all of those messages being sent, it won't activate as a "click". pyautogui.click should simulate it properly, but if you experiment with the app and look at how it responds (click mouse without release, what happens?) you might be able to improve the simulation. Maybe put a delay between pyautogui.mouseDown() and pyautogui.mouseUp().

但我的预感是该应用程序以与 python 脚本不同的用户身份运行.

But my hunch is the app is running as a different user than the python script.

这篇关于应用程序不响应 Windows API 事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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