Remote Desktop and WinBatch
Question:
I have an application that I am running on a remote desktop. After I launch the application I minimize the remote desktop connection,
but the application stops. Has this happened to anyone else?
Question (more):
Yes, I just discovered this happening to me. In my case I am running a WB script on a VM that I access with Remote Desktop.
This script is sending keystrokes. I made it loop until the window actually received the keystrokes. This doesn't happen until
I open the display.
Answer:
It is very likely that minimizing the remote desktop client is equivalent to putting the remote session into a disconnected state,
which is functionally the same as locking the local workstation in terms of how the SendKey*() functions work. Which is to say,
the SendKey*() functions *don't* work when the desktop session is locked or disconnected. This happens due to the fact that a
desktop session one of those states does not have a logical keyboard associated with it so there's no way for simulated
keystrokes to be sent.
Instead, you need to make use of the Control Manager extender to directly manipulate controls in the application rather
than relying on blind sending of keystrokes.
Alternative option: You might try to find a setting for your Remote Desktop server or client to keep connected even when minimized. One possible way to work around the issue, you can change the Remote
Desktop’s registry settings on your local computer (where you launch the Remote Desktop):
- On your local computer, close all open Remote Desktop sessions.
- On 64-bit versions of Windows, launch the 64-bit version of the Registry editor (for example, by selecting Start | Run and typing regedit).
- Navigate to one of the following Registry keys, depending on whether you wish to modify the Remote Desktop settings only for the current user or for all users on the computer:
- HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
- HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
- Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.
- Close the Registry Editor.
Now when you minimize the Remote Desktop Connection window on your computer, this will not affect the remote computer’s GUI and the GUI will be available to your automated tests.
Article ID: W17259
File Created: 2014:01:23:10:46:52
Last Updated: 2014:01:23:10:46:52