想要服务器桌面的屏幕截图 [英] Want screen capture of server desktop

查看:70
本文介绍了想要服务器桌面的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp.net开发基于Web的服务工具,我们将使用

我们的产品进行分发。此服务工具将用于远程配置产品,问题

确定等。我希望能够做的一件事是显示一个屏幕

捕获我们的产品运行。我有代码来获取

桌面的屏幕截图,我也知道如何将图像发送回客户端进行显示。

问题在于在服务器上的asp.net代码中运行

时,获取桌面图像的代码不起作用。


从我在主题,我怀疑问题是网络服务器

是在自己的虚拟桌面下运行的。如果是这样,有人可以告诉我,如果我想做什么,或许是可能的话,如果是这样的话。我使用的代码如下:

(我相信gr1.GetHdc()是事情开始失败的地方)。


System.Drawing.Image myImage = new Bitmap(1600,1200);

图形gr1 = Graphics.FromImage(myImage);

IntPtr dc1 = gr1.GetHdc();

IntPtr dc2 = GetWindowDC(GetDesktopWindow());

BitBlt(dc1,0,0,1600,1200,dc2,0,0,1336376);


Response.BufferOutput = true;

Response.Clear();

Response.ContentType =" image / gif";

myImage.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Gif);

Response.End();


谢谢,


Terry

I am developing a web based service tool using asp.net that we will distribute with
our product. This service tool will be used for remotely configuring the product, problem
determination, etc. One thing that I would like to be able to do is display a screen
capture of our product running. I have the code to get the screen capture of the
desktop and I also know how to send the image back to the client to be displayed.
The problem is that the code to grab the desktop image doesn''t work when running
in my asp.net code on the server.

From what I have read on the subject, I suspect the problem is that the web server
is running under its own virtual desktop. If so can someone tell me if what I am
trying to do is even possible and if so how. The code I am using is as follows:
(I believe gr1.GetHdc() is where things start to fail).

System.Drawing.Image myImage = new Bitmap(1600, 1200);
Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1, 0, 0, 1600, 1200, dc2, 0, 0, 13369376);

Response.BufferOutput=true;
Response.Clear();
Response.ContentType="image/gif";
myImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
Response.End();

Thanks,

Terry

推荐答案

我认为你不能在服务器上获得打印屏幕,因为服务器是

注销。

您可以尝试更改IIS服务属性。您可以尝试检查允许

与桌面标记交互。


Brun


" Te *** ******@tech.com" <一个******* @ discussions.microsoft.com>写在

消息新闻:07 ********************************** @ microsof t.com ...
I think that you can''t get a printscreen on server because the server is
logged off.
You can try changing IIS service property. You can try to check Allow
Interact with desktop flag.

Brun

"Te*********@tech.com" <an*******@discussions.microsoft.com> wrote in
message news:07**********************************@microsof t.com...
我正在使用asp.net开发基于Web的服务工具,我们将使用我们的产品分发
。此服务工具将用于远程配置
产品,问题确定等。我希望能够做的一件事是
显示我们产品运行的屏幕截图。我有代码来获取桌面的
屏幕,我也知道如何将图像发送回客户端显示为
。问题是,当我在服务器上的asp.net代码中运行
时,抓取桌面图像的代码不起作用。

从我读到的关于这个主题的内容来看,我怀疑问题是
web服务器在自己的虚拟桌面下运行。如果是这样,有人可以告诉我,如果
我想要做什么甚至是可能的,如果是这样的话。我使用的代码是
如下:(我相信gr1.GetHdc()是事情开始失败的地方)。

System.Drawing.Image myImage = new Bitmap(1600,1200 );
图形gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1 ,0,0,1600,1200,dc2,0,0,13369376);

Response.BufferOutput = true;
Response.Clear();
Response.ContentType = " image / gif";
myImage.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Gif); Response.End();

谢谢,
特里
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. One thing that I would like to be able to do is display a screen capture of our product running. I have the code to get the screen capture of the desktop and I also know how to send the image back to the client to be displayed. The problem is that the code to grab the desktop image doesn''t work when running in my asp.net code on the server.

From what I have read on the subject, I suspect the problem is that the web server is running under its own virtual desktop. If so can someone tell me if what I am trying to do is even possible and if so how. The code I am using is as follows: (I believe gr1.GetHdc() is where things start to fail).

System.Drawing.Image myImage = new Bitmap(1600, 1200);
Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1, 0, 0, 1600, 1200, dc2, 0, 0, 13369376);

Response.BufferOutput=true;
Response.Clear();
Response.ContentType="image/gif";
myImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); Response.End();

Thanks,

Terry



您可能会找到更多专家在这个新闻组


microsoft.public.dotnet.framework.drawing
You will probably find more expert at this newsgroup

microsoft.public.dotnet.framework.drawing


我不确定你的意思是什么?服务器已注销。在这种情况下,

我们的产品将在我希望进行屏幕时运行在服务器上

捕获,因此它将被某人登录。 br />

我确实尝试检查允许与桌面标记交互对于WWW出版

服务,但这似乎没有帮助...还有其他服务我还应该

检查那个标志?


Terry


----- Bruno Sirianni写道:-----


我认为您无法在服务器上获得打印屏幕,因为服务器已经注销了


您可以尝试更改IIS服务属性。您可以尝试检查允许

与桌面标记交互。


Brun


" Te *** ******@tech.com" <一个******* @ discussions.microsoft.com>写在

消息新闻:07 ********************************** @ microsof t.com ...
I am not sure what you mean by "the server is logged off". In this case,
our product will be running on the server at the time I wish to do the screen
capture, so it will have been logged onto by someone.

I did try checking "Allow Interact with desktop flag" for the WWW Publishing
service but that didn''t seem to help ... is there another service I should also
be checking that flag for?

Terry

----- Bruno Sirianni wrote: -----

I think that you can''t get a printscreen on server because the server is
logged off.
You can try changing IIS service property. You can try to check Allow
Interact with desktop flag.

Brun

"Te*********@tech.com" <an*******@discussions.microsoft.com> wrote in
message news:07**********************************@microsof t.com...
我正在使用asp.net开发基于Web的服务工具,我们将使用我们的产品分发
。此服务工具将用于远程配置
产品,问题确定等。我希望能够做的一件事是
显示我们产品运行的屏幕截图。我有代码来获取桌面的
屏幕,我也知道如何将图像发送回客户端显示为
。问题是,当我在服务器上的asp.net代码中运行
时,抓取桌面图像的代码不起作用。
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. One thing that I would like to be able to do is display a screen capture of our product running. I have the code to get the screen capture of the desktop and I also know how to send the image back to the client to be displayed. The problem is that the code to grab the desktop image doesn''t work when running in my asp.net code on the server.
从我对这个主题的读到,我怀疑问题是
From what I have read on the subject, I suspect the problem is that the


Web服务器是在自己的虚拟桌面下运行的。如果是这样,有人可以告诉我,如果
我想要做什么甚至是可能的,如果是这样的话。我使用的代码是
如下:(我相信gr1.GetHdc()是事情开始失败的地方)。

web server is running under its own virtual desktop. If so can someone tell me if what I am trying to do is even possible and if so how. The code I am using is as follows: (I believe gr1.GetHdc() is where things start to fail).

System.Drawing.Image myImage = new Bitmap(1600,1200 ); Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1,0,0,1600 ,1200,dc2,0,0,13369376);
System.Drawing.Image myImage = new Bitmap(1600, 1200); Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetWindowDC(GetDesktopWindow());
BitBlt(dc1, 0, 0, 1600, 1200, dc2, 0, 0, 13369376);
Response.BufferOutput = true;
Response.BufferOutput=true;


Response.Clear();
Response.ContentType =" image / gif" ;;
myImage.Save(Response.OutputStream,


Response.Clear();
Response.ContentType="image/gif";
myImage.Save(Response.OutputStream,



System.Drawing.Imaging.ImageFormat.Gif); Response.End();


System.Drawing.Imaging.ImageFormat.Gif); Response.End();

谢谢,
Terry
Thanks,
Terry



这篇关于想要服务器桌面的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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