SetCursorPos fail with “the parameter is incorrect

2019-03-06 23:06发布

I have application running on win 2008 server. It is using win32 api and it works just fine when i connected to the server with RDP. When i disconnect every call to SetCursorPos end with this failure. Coordinates (arguments) are same for both cases. Any thoughts ?

1条回答
甜甜的少女心
2楼-- · 2019-03-06 23:15

If RDP is disconnected, it's impossible to do anything with GUI (no screen, no mouse). There are few workarounds though.

  1. Keep RDP open (not in a full screen) and switch to another window on local machine (RDP must not be minimized). In this case your script will work, but it's not fully automated solution because turning your local machine off (when you leaving the office at the end of day) will break RDP session (and your GUI related task). It's not suitable for long running GUI tests.

  2. You may do more complicated automation for a long term: one master server may keep VNC connections (cross-platform analogue of RDP) to every worker machine so that GUI related tasks are running continuously. But there are many pitfalls on this way (especially on Windows). You may require to set up auto logon, to install and customize (with some magic!) VNC server software etc...

查看更多
登录 后发表回答