如何使用C#捕获Internet Explorer ScreenShot? [英] How to capture Internet Explorer ScreenShot using C#?

查看:108
本文介绍了如何使用C#捕获Internet Explorer ScreenShot?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#捕获整个网页的图像 [ ^ ]





上面提供的链接是一个项目,用于使用C#截取Internet Explorer。我下载了该项目并使用它。但是无论iexplorer窗口如何,由它创建的输出图像都是完整的黑色图像!!我是一个自动化项目,我需要截取Internet Explorer网页的截图。谁能帮帮我吗?

该项目的作者是 http://www.codeproject.com/Members/ Douglas-M-Weems [ ^ ]



紧急删除:对你来说可能很紧急,但这不是我们的意思。所有你强调紧迫感的事情就是让我们认为你已经太晚了,并且希望我们为你做这件事。这会让一些人感到烦恼,并且可能会减慢回复。

- OriginalGriff [/ edit]

解决方案

不要在问题下发帖&安培;答案 - 如果您从文章中获得了代码,那么该文章底部会出现一个新消息按钮,这会导致将电子邮件发送给作者。然后他们会被告知你希望与他们交谈。

在这里发布这个依赖于他们匆匆而过并意识到这是为了他们。


谢谢你你的建议OriginalGriff :)

我得到了答案!!!

  //  获取浏览器文档句柄 

while (hwndInt! = 0
{
hwndInt = hwnd.ToInt32();
GetClassName(hwndInt,sbc, 256 );

if (sbc.ToString()。IndexOf( Shell DocObject视图 0 > -1 )
{
hwnd = FindWindowEx(hwnd, IntPtr .Zero, < span class =code-string> Internet Explorer_Server, IntPtr .Zero);
break ;
}
if (sbc.ToString()。IndexOf( TabWindowClass 0 > -1) // IE7
{
hwnd = FindWindowEx(hwnd, IntPtr .Zero, Shell DocObject View IntPtr的 .Zero);
hwnd = FindWindowEx(hwnd, IntPtr .Zero, Internet Explorer_Server IntPtr .Zero);
break ;
}
if (sbc.ToString()。IndexOf( 框架选项卡 0 > -1 ) // IE8
{
hwnd = FindWindowEx(hwnd, IntPtr .Zero, TabWindowClass IntPtr的 .Zero);
hwnd = FindWindowEx(hwnd, IntPtr .Zero, Shell DocObject View IntPtr .Zero);
hwnd = FindWindowEx(hwnd, IntPtr .Zero, Internet Explorer_Server IntPtr .Zero);
break ;
}

hwnd = GetWindow(hwnd,GW_HWNDNEXT);

}







是我需要在现有的修改代码!!!


Image Capture Whole Web Page using C#[^]


The link provided above is a project used to take screenshot of internet explorer using C#.I downloaded that project and used it. But the output image created by the is a complete black image irrespective of the iexplorer window!!. Mine is an automation project and I need to take the screenshot of internet explorer webpages. Can anyone please help me?
the author of the project is http://www.codeproject.com/Members/Douglas-M-Weems[^]

[edit]Urgency deleted: It may be urgent to you, but it isn''t to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.
- OriginalGriff[/edit]

解决方案

Don''t post this under Questions & Answers - if you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.


Thanks for your suggestion OriginalGriff :)
I got the answer for that!!!

//Get Browser "Document" Handle

           while (hwndInt != 0)
           {
               hwndInt = hwnd.ToInt32();
               GetClassName(hwndInt, sbc, 256);

               if(sbc.ToString().IndexOf("Shell DocObject View", 0) > -1)
               {
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero);
                   break;
               }
               if (sbc.ToString().IndexOf("TabWindowClass", 0) > -1) //IE7
               {
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Shell DocObject View", IntPtr.Zero);
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero);
                   break;
               }
               if (sbc.ToString().IndexOf("Frame Tab", 0) > -1) // IE8
               {
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "TabWindowClass", IntPtr.Zero);
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Shell DocObject View", IntPtr.Zero);
                   hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero);
                   break;
               }

               hwnd = GetWindow(hwnd, GW_HWNDNEXT);

           }




is the modification i need to do in the existing code!!!


这篇关于如何使用C#捕获Internet Explorer ScreenShot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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