最小化断开连接时的终端会话在捕获桌面快照时返回空白屏幕 [英] Terminal session when minimizeddisconnected returns a blank screen upon capturing desktop snapshot

查看:19
本文介绍了最小化断开连接时的终端会话在捕获桌面快照时返回空白屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的 JAVA 代码来捕获远程机器的桌面

I am using the below JAVA code to capture the desktop of a remote machine

    Robot robot = new Robot();
    BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));

    ByteArrayOutputStream imageBytes = new ByteArrayOutputStream();
    ImageIO.write(screenShot, "PNG", imageBytes);

    return imageBytes.toByteArray();

但是,当与远程计算机的终端会话最小化或断开连接时,捕获的图像是空白的.感谢您在解决问题方面的帮助,至少在最小化的情况下.

However the captured image is blank, when the terminal session to the remote machine is either minimized or disconnected. I appreciate your help in resolving the issue, at the very least the minimized scenario.

配置:我在运行 Windows 7 的物理机和运行 Windows Server 2008 R2 的虚拟机上遇到了同样的问题.

Configuration: I have the same issues with a physical machine running windows 7 and a virtual machine running windows server 2008 R2.

来自 MSDN 的更多见解:

More insights from MSDN:

为什么断开与 RDP 的连接后会出现黑屏?http://msdn.microsoft.com/en-us/library/aa383015%28VS.85%29.aspx

这是我的尝试,但以下都没有成功:

RDP窗口最小化时如何获取数据?您可以强制 RDP 显示驱动程序在最小化时发送数据,请尝试以下步骤并告诉我它是如何进行的:1)添加以下键HKEY_LOCAL_MACHINESoftwareMicrosoftTerminal Server Client 创建了一个新的 DWORD 值并将其命名为 RemoteDesktop_SuppressWhenMinimized.指定 2 作为值数据.

How to get data when RDP window minimized ?   You can force the RDP display driver to send data when minized, try these steps and let me know how it goes:   1) Add the following key HKEY_LOCAL_MACHINESoftwareMicrosoftTerminal Server Client Created a new DWORD value and named it RemoteDesktop_SuppressWhenMinimized. Specified 2 as the value data.

注意:还尝试将注册表项添加到 HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftTerminal Server Client2) 禁用位图缓存 (http://technet.microsoft.com/en-us/library/cc737325(WS.10).aspx)在远程桌面连接"窗口中,单击选项".

Note: Also tried adding the registry key to HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftTerminal Server Client   2) Disable bitmap caching (http://technet.microsoft.com/en-us/library/cc737325(WS.10).aspx) In the Remote Desktop Connection window, click Options.

在体验"选项卡上,确认已选中位图缓存"复选框.或者,要禁用位图缓存,请清除位图缓存复选框

On the Experience tab, verify that the Bitmap caching check box is selected. Or, to disable bitmap caching, clear theBitmap caching check box

推荐答案

如果您最小化远程桌面窗口,Windows 会将远程会话切换到无 GUI 模式并且不显示窗口和控件.因此,TestComplete(或 TestExecute)将无法与被测应用程序的 GUI 交互,因为它不存在并且您的自动化 GUI 测试将失败.要解决此问题,您可以在本地计算机(启动远程桌面的位置)上更改远程桌面的注册表设置:在本地计算机上,关闭所有打开的远程桌面会话.启动注册表编辑器 (regedit.exe).导航到以下注册表项之一,具体取决于您是希望为当前用户还是为计算机上的所有用户修改远程桌面设置:

If you minimize the Remote Desktop window, Windows switches the remote session to the GUI-less mode and does not display windows and controls. As a result, TestComplete (or TestExecute) will be unable to interact with the tested application’s GUI, as it does not exist and your automated GUI test will fail. 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. Launch the Registry editor (regedit.exe). 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_USERSoftwareMicrosoft终端服务器客户端HKEY_LOCAL_MACHINESoftwareMicrosoft终端服务器客户端创建一个名为 RemoteDesktop_SuppressWhenMinimized 的 DWORD 值并将其设置为 2.

HKEY_CURRENT_USERSoftwareMicrosoftTerminal Server Client HKEY_LOCAL_MACHINESoftwareMicrosoftTerminal Server Client Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.

或者您可以通过以下步骤以编程方式进行:

Or you can do it programmatically by following steps:

  • 透明窗口
  • 恢复窗口
  • 拍摄
  • 再次最小化它
  • 移除透明度

这篇关于最小化断开连接时的终端会话在捕获桌面快照时返回空白屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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