Click here to Skip to main content
15,889,096 members
Articles / Web Development / HTML

Flicker Free Drawing In MFC

Rate me:
Please Sign up or sign in to vote.
4.96/5 (174 votes)
25 Mar 2002CPOL1 min read 1.2M   18K   314  
A simple animation example which is used to show CMemDC in several modes
// ParticleTestDoc.cpp : implementation of the CParticleTestDoc class
//

#include "stdafx.h"
#include "ParticleTest.h"

#include "ParticleTestDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CParticleTestDoc

IMPLEMENT_DYNCREATE(CParticleTestDoc, CDocument)

BEGIN_MESSAGE_MAP(CParticleTestDoc, CDocument)
	//{{AFX_MSG_MAP(CParticleTestDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CParticleTestDoc, CDocument)
	//{{AFX_DISPATCH_MAP(CParticleTestDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//      DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IParticleTest to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {FE681993-9DE8-11D3-AB75-00805FC73D05}
static const IID IID_IParticleTest =
{ 0xfe681993, 0x9de8, 0x11d3, { 0xab, 0x75, 0x0, 0x80, 0x5f, 0xc7, 0x3d, 0x5 } };

BEGIN_INTERFACE_MAP(CParticleTestDoc, CDocument)
	INTERFACE_PART(CParticleTestDoc, IID_IParticleTest, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CParticleTestDoc construction/destruction

CParticleTestDoc::CParticleTestDoc()
{
	// TODO: add one-time construction code here

	EnableAutomation();

	AfxOleLockApp();
}

CParticleTestDoc::~CParticleTestDoc()
{
	AfxOleUnlockApp();
}

BOOL CParticleTestDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CParticleTestDoc serialization

void CParticleTestDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CParticleTestDoc diagnostics

#ifdef _DEBUG
void CParticleTestDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CParticleTestDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CParticleTestDoc commands

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
I work at Tektronix in Beaverton OR. I've been programming for fun since 1975 (I started while in a Computer Explorer Scout group in Spokane WA). I've been programming in C since 1979 and I've been working professionally since 1983.

I really enjoy www.codeproject.com. It has saved me an incredible amount of time. I only hope my small contributions have given back some of what I've taken.

Comments and Discussions