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

Animated Dialog Windows

Rate me:
Please Sign up or sign in to vote.
4.93/5 (38 votes)
17 Apr 2000 234.6K   7.3K   128  
A class that provides some simple, yet spectacular window animation effects. Try the demo!
// TestDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Anim.h"
#include "TestDlg.h"

#include "AnimEffect.h"


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

/////////////////////////////////////////////////////////////////////////////
// CTestDlg dialog


CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTestDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
	//{{AFX_MSG_MAP(CTestDlg)
	ON_WM_CREATE()
	ON_WM_DESTROY()
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestDlg message handlers



int CTestDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	///////////////////
	CRect rc(lpCreateStruct->x, lpCreateStruct->y, 
		lpCreateStruct->x + lpCreateStruct->cx,
		lpCreateStruct->y + lpCreateStruct->cy );

	AnimEffect ae;
	ae.Open( rc );
	///////////////////
	return 0;
}

void CTestDlg::OnDestroy() 
{
	///////////////////
	CRect rc;
	GetWindowRect( rc );
	ShowWindow(SW_HIDE);
	
	AnimEffect ae;
	ae.Close( rc );
	///////////////////
	CDialog::OnDestroy();
}

void CTestDlg::OnClose() 
{
	CDialog::OnClose();
	OutputDebugString("On close\r\n");
	///////////////////
	CRect rc;
	GetWindowRect( rc );
	
	AnimEffect ae;
	ae.Close( rc );
	///////////////////
}


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.


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions