捕获最小化远程桌面截图 [英] Capturing screenshots of a minimized remote desktop

查看:218
本文介绍了捕获最小化远程桌面截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的C#代码,而我使用捕捉到一个远程桌面(RDP)会话中的截图。它工作正常时,会是积极的,但失败,如果我最小化会话无效句柄例外。



有什么办法,使这项工作,或者是屏幕?基本上是水涨船高的时候,会被最小化

 字符串文件名= @C:\Snap.png 
规格= bitmapSize新的大小(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
使用(位图位图=新位图(bitmapSize.Width,bitmapSize.Height,PixelFormat.Format24bppRgb))
使用(图形图像= Graphics.FromImage(位图))
{
graphics.CopyFromScreen(//异常这里抛出
新点(0,0),
新点(0,0),
bitmapSize);
bitmap.Save(文件名,ImageFormat.Png);
}


解决方案

您必须暂时恢复窗口,捕捉,并再次将其最小化。 此链接显示怎么办呢默默


I have the following C# code, which I am using to capture a screenshot inside a remote desktop (RDP) session. It works fine when the session is active, but fails with an invalid handle exception if I minimize the session.

Is there any way to make this work, or is the screen essentially "gone" when the session is minimized?

string filename = @"C:\Snap.png";
Size bitmapSize = new Size( Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height );
using (Bitmap bitmap = new Bitmap(bitmapSize.Width, bitmapSize.Height, PixelFormat.Format24bppRgb))
using (Graphics graphics = Graphics.FromImage(bitmap))
{
    graphics.CopyFromScreen( // Exception thrown here
        new Point(0, 0), 
        new Point(0, 0), 
        bitmapSize);
    bitmap.Save(filename, ImageFormat.Png);
}

解决方案

You have to temporarily restore the window, capture, and minimize it again. This link shows how to do it silently

这篇关于捕获最小化远程桌面截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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