Click here to Skip to main content
15,884,043 members
Articles / Desktop Programming / MFC

Rendering an IHTMLElement to an Image File Using GDI+

Rate me:
Please Sign up or sign in to vote.
4.73/5 (11 votes)
4 Dec 20068 min read 110.2K   1.2K   72  
Capture an HTML document as an image and save it.
// WebPageSnapShotView.h : interface of the CWebPageSnapShotView class
//


#pragma once


class CWebPageSnapShotView : public CHtmlView
{
protected: // create from serialization only
	CWebPageSnapShotView();
	DECLARE_DYNCREATE(CWebPageSnapShotView)

// Attributes
public:
	CWebPageSnapShotDoc* GetDocument() const;

// Operations
public:

// Overrides
	public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void OnInitialUpdate(); // called first time after construct

// Implementation
public:
	virtual ~CWebPageSnapShotView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in WebPageSnapShotView.cpp
inline CWebPageSnapShotDoc* CWebPageSnapShotView::GetDocument() const
   { return reinterpret_cast<CWebPageSnapShotDoc*>(m_pDocument); }
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Team Leader The Judge Group
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions