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 ?
-
Presumably after you disconnect, you are no longer logged in. – David Heffernan Jan 26 '16 at 07:28
-
Application still running though , do you have any suggestions for solution ? – yabloki Jan 26 '16 at 07:37
-
1Solution? We don't know what the problem is. Since no user is connected to the session, why would you need to call SetCursorPos? – David Heffernan Jan 26 '16 at 07:38
-
I need to manipulate gui program, i am using pywinauto to to manupulate almost all controls, but there is one not standart win32 control that cant be manipulated with pywinauto, this is why i need to "cliclk" on it with the mouse. Thats why i call SetCursorPos – yabloki Jan 26 '16 at 08:02
-
Not going to work then I guess. – David Heffernan Jan 26 '16 at 08:11
-
1Well, if you have to call SetCursorPos, and SetCursorPos fails when there is no user connected to the session, you are stuck aren't you. – David Heffernan Jan 26 '16 at 08:28
1 Answers
If RDP is disconnected, it's impossible to do anything with GUI (no screen, no mouse). There are few workarounds though.
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.
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...

- 9,386
- 6
- 25
- 78