Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
61 views

Getting Started With App Wizard

This C++ code defines classes for a dialog box (CDlg) and view (CAppwizView) that are used to display student information entered into the dialog box. The dialog box defines data members for student details and programming skills checkboxes. The view draws the student data obtained from the dialog box onto the screen and handles printing functions.

Uploaded by

michael.ferraris
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Getting Started With App Wizard

This C++ code defines classes for a dialog box (CDlg) and view (CAppwizView) that are used to display student information entered into the dialog box. The dialog box defines data members for student details and programming skills checkboxes. The view draws the student data obtained from the dialog box onto the screen and handles printing functions.

Uploaded by

michael.ferraris
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

PROGRAM

// Dlg.cpp : implementation file

#include "stdafx.h"
#include "appwiz.h"
#include "Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlg dialog

CDlg::CDlg(CWnd* pParent /*=NULL*/)


: CDialog(CDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlg)
m_C = FALSE;
m_CPP = FALSE;
m_JAVA = FALSE;
m_HTML = FALSE;
m_PHP = FALSE;
m_DOTNET = FALSE;
m_dept = _T("");
m_name = _T("");
m_roll = _T("");
m_year = _T("");
m_gender = -1;
m_aggr = 0;
//}}AFX_DATA_INIT
}

void CDlg::DoDataExchange(CDataExchange* pDX)


{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlg)
DDX_Check(pDX, IDC_CHECK1, m_C);
DDX_Check(pDX, IDC_CHECK2, m_CPP);
DDX_Check(pDX, IDC_CHECK3, m_JAVA);
DDX_Check(pDX, IDC_CHECK4, m_HTML);
DDX_Check(pDX, IDC_CHECK5, m_PHP);
DDX_Check(pDX, IDC_CHECK6, m_DOTNET);
DDX_CBString(pDX, IDC_COMBO1, m_dept);
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT2, m_roll);
DDX_LBString(pDX, IDC_LIST1, m_year);
DDX_Radio(pDX, IDC_RADIO1, m_gender);
DDX_Text(pDX, IDC_EDIT3, m_aggr);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDlg, CDialog)
//{{AFX_MSG_MAP(CDlg)
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlg message handlers

void CDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CDialog::OnOK();
}

BOOL CDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here


CListBox *plb=(CListBox*)GetDlgItem(IDC_LIST1);
plb->InsertString(-1,"I yr");
plb->InsertString(-1,"II yr");
plb->InsertString(-1,"III yr");
plb->InsertString(-1,"IV yr");

CProgressCtrl *pprog=(CProgressCtrl*)GetDlgItem(IDC_PROGRESS1);
pprog->SetRange(0,100);
pprog->SetPos(1);

return TRUE;
}

void CDlg::OnChangeEdit3()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here

UpdateData(true);
CProgressCtrl *pprog=(CProgressCtrl*)GetDlgItem(IDC_PROGRESS1);
pprog->SetPos(m_aggr);
}

void CDlg::OnCancel()
{
// TODO: Add extra cleanup here
exit(0);

CDialog::OnCancel();
}
// appwizView.cpp : implementation of the CAppwizView class

#include "stdafx.h"
#include "appwiz.h"
#include "Dlg.h"
#include "appwizDoc.h"
#include "appwizView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAppwizView

IMPLEMENT_DYNCREATE(CAppwizView, CView)

BEGIN_MESSAGE_MAP(CAppwizView, CView)
//{{AFX_MSG_MAP(CAppwizView)
// 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
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW,
CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAppwizView construction/destruction

CAppwizView::CAppwizView()
{
// TODO: add construction code here
}

CAppwizView::~CAppwizView()
{
}

BOOL CAppwizView::PreCreateWindow(CREATESTRUCT& cs)


{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAppwizView drawing

void CAppwizView::OnDraw(CDC* pDC)


{
Q:

static int x=100;

CAppwizDoc* pDoc = GetDocument();


ASSERT_VALID(pDoc);
// TODO: add draw code for native data here

CDlg d;
d.DoModal();

if(d.m_name==_T(""))
{
MessageBox("Please Enter Name !!");
goto Q;
}
else
pDC->TextOut(x,100,"NAME : " + d.m_name);

if(d.m_roll==_T(""))
{
MessageBox("Please Enter Roll Number !!");
goto Q;
}
else
pDC->TextOut(x,130,"ROLL : " + d.m_roll);

if(d.m_gender==0)
pDC->TextOut(x,160,"SEX : MALE");
else if(d.m_gender==1)
pDC->TextOut(x,160,"SEX : FEMALE");
else
{
MessageBox("Please select Gender !!");
goto Q;
}

if(d.m_dept==_T(""))
{
MessageBox("Please Select Department !!");
goto Q;
}
else
pDC->TextOut(x,190,"DEPT : " + d.m_dept);

if(d.m_year==_T(""))
{
MessageBox("Please select year of study !!");
goto Q;
}
else
pDC->TextOut(x,220,"YEAR : " + d.m_year);

pDC->TextOut(x,250,"Prog Skills : ");


x=x+100;
if(d.m_C)
pDC->TextOut(x,250,"C");
if(d.m_CPP)
pDC->TextOut(x=x+45,250,"C++");
if(d.m_JAVA)
pDC->TextOut(x=x+45,250,"JAVA");
if(d.m_HTML)
pDC->TextOut(x=x+45,250,"HTML");
if(d.m_PHP)
pDC->TextOut(x=x+45,250,"PHP");
if(d.m_DOTNET)
pDC->TextOut(x=x+45,250,".NET");
}

/////////////////////////////////////////////////////////////////////////////
// CAppwizView printing

BOOL CAppwizView::OnPreparePrinting(CPrintInfo* pInfo)


{
// default preparation
return DoPreparePrinting(pInfo);
}

void CAppwizView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)


{
// TODO: add extra initialization before printing
}

void CAppwizView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)


{
// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CAppwizView diagnostics

#ifdef _DEBUG
void CAppwizView::AssertValid() const
{
CView::AssertValid();
}

void CAppwizView::Dump(CDumpContext& dc) const


{
CView::Dump(dc);
}
CAppwizDoc* CAppwizView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAppwizDoc)));
return (CAppwizDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CAppwizView message handlers

OUTPUT

You might also like