Application not responding to Windows API events?

南楼画角 提交于 2019-12-08 07:57:54

问题


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?

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

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.


回答1:


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.

Try running your python program as administrator.

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.

EDIT: 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().

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



来源:https://stackoverflow.com/questions/44466855/application-not-responding-to-windows-api-events

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!