Click here to Skip to main content
15,896,154 members
Articles / Desktop Programming / MFC

Win32 AppWizard (exe)

Rate me:
Please Sign up or sign in to vote.
3.43/5 (5 votes)
18 Aug 2001 73.8K   1.5K   17  
A simple AppWizard for writing Win32 Applications
// cstm3dlg.cpp : implementation file
//

#include "stdafx.h"
#include "Win32.h"
#include "cstm3dlg.h"
#include "Win32aw.h"

#ifdef _PSEUDO_DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCustom3Dlg dialog


CCustom3Dlg::CCustom3Dlg()
	: CAppWizStepDlg(CCustom3Dlg::IDD)
{
	//{{AFX_DATA_INIT(CCustom3Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCustom3Dlg::DoDataExchange(CDataExchange* pDX)
{
	CAppWizStepDlg::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCustom3Dlg)
	DDX_Control(pDX, IDC_LIST_PROJECT, c_projectlist);
	DDX_Control(pDX, IDC_YELLOW, c_finish);
	//}}AFX_DATA_MAP
}

// This is called whenever the user presses Next, Back, or Finish with this step
//  present.  Do all validation & data exchange from the dialog in this function.
BOOL CCustom3Dlg::OnDismiss()
{
	if (!UpdateData(TRUE))
		return FALSE;

	// TODO: Set template variables based on the dialog's data.
	Win32aw.m_Dictionary.RemoveKey("SDI_VIEW");
	Win32aw.m_Dictionary.RemoveKey("MDI_VIEW");
	if(Win32aw.GetAppType()==4) {
		switch(Win32aw.GetViewType()) {
			case 0:
				Win32aw.m_Dictionary["SDI_VIEW"]="Yes";
				break;
			case 1:
				Win32aw.m_Dictionary["SDI_EDIT"]="Yes";
				break;
			case 2:
				Win32aw.m_Dictionary["SDI_RICHEDIT"]="Yes";
				break;
		}
	}
	else {
		switch(Win32aw.GetViewType()) {
			case 0:
				Win32aw.m_Dictionary["MDI_VIEW"]="Yes";
				break;
			case 1:
				Win32aw.m_Dictionary["MDI_EDIT"]="Yes";
				break;
			case 2:
				Win32aw.m_Dictionary["MDI_RICHEDIT"]="Yes";
				break;
		}
	}
	return TRUE;	// return FALSE if the dialog shouldn't be dismissed
}


BEGIN_MESSAGE_MAP(CCustom3Dlg, CAppWizStepDlg)
	//{{AFX_MSG_MAP(CCustom3Dlg)
	ON_WM_PAINT()
	ON_LBN_SELCHANGE(IDC_LIST_PROJECT, OnSelchangeListProject)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CCustom3Dlg message handlers

BOOL CCustom3Dlg::OnInitDialog() 
{
	CAppWizStepDlg::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_bmpFinish.LoadBitmap(IDB_FINISH);
	DrawBmp();
	c_projectlist.AddString("View");
	c_projectlist.AddString("EditView");
	c_projectlist.AddString("RichEditView");
	Win32aw.SetViewType(0);
	c_projectlist.SetCurSel(0);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCustom3Dlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	DrawBmp();
	// Do not call CAppWizStepDlg::OnPaint() for painting messages
}

void CCustom3Dlg::DrawBmp()
{
	CDC cpDcFr, *cdc;
	CRect rect;
	// ��Ʈ���� �׷��ش�.
	c_finish.GetWindowRect(rect);
	cdc = c_finish.GetDC();
	cpDcFr.CreateCompatibleDC(cdc);
	cpDcFr.SelectObject(m_bmpFinish);
	cdc->StretchBlt(0,0,rect.Width()-3,rect.Height(),&cpDcFr,0,0,178,274,SRCCOPY);
}

void CCustom3Dlg::OnSelchangeListProject() 
{
	// TODO: Add your control notification handler code here
	int index=c_projectlist.GetCurSel();
	switch(index) {
		case 0:
			Win32aw.SetViewType(0);
			break;
		case 1:
			Win32aw.SetViewType(1);
			break;
		case 2:
			Win32aw.SetViewType(2);
			break;
	}
}

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
Web Developer
Korea (Republic of) Korea (Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions