Web page screenshot using IE

Source: Internet
Author: User

1. Purpose

In codeproject, we can see that someone has done this. I made a slight modification and made it into a command line. The usage is as follows:
Iesnap.exe URL filename
Used to capture the web of a URL pair and save the web in filename.
URL: the URL
Filename: Save the file name

2. Ideas

Webbrowser control and mshtml are mainly used.
A. Create webbrowser Control
B. Obtain the iwebbrowser2 interface from webbrowser control and use iwebbrowser2: navigate2 to access the URL.
C. Obtain ihtmlelementrender (webbrowser-> ihtmldocument2-> ihtmlelement-> ihtmlelementrender) and use the drawtodc interface to obtain the page content corresponding to the URL.
D. Use the image of GDI to save it to filename.

3.
Let's take a look at the original article for better answers.
The article I read: Capture an HTML document as an image
Another article in C #: Image Capture Whole Web Page using C #

4. Problem

A. The DocumentComplete event occurs when each element on the corresponding page of the URL is downloaded. Therefore, (you do not know which event is the download completed on the entire page :/
B. Now we use MFC to create WebBrowser Control. I don't know how to create this Control in Win32 Application.
C. I don't know how to get the size of the entire page. Now I can only save a part of the page :(
I already know how to do this.
The scrollWidth & scrollHeight of IHTMLElement2 is implemented by adding scrollLeft & scrollTop, but I don't know why. The put_scrollTop & put_scrollLeft functions seem wrong and can only be intercepted on some pages. :( I don't know why.

Code can be downloaded here: http://www.cppblog.com/Files/bigsml/iesnapshot.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.