Visual C++/Windows SDK Program for the Implementation of Dialog Based Application | CS1255 - Visual Programming Laboratory

AIM:
To write a Visual C++/Windows SDK Program for the Implementation of Dialog Based Application in CS1255 - Visual Programming Lab.

SOURCE CODE:
Scs.cpp: implementation file
#include "stdafx.h"
#include "student.h"
#include "Scs.h"
#include "seat.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Scs dialog
Scs::Scs(CWnd* pParent /*=NULL*/)
    : CDialog(Scs::IDD, pParent)
{
    //{{AFX_DATA_INIT(Scs)
    m_n1 = 0;
    m_n2 = 0;
    m_n3 = 0;
    m_r1 = 0;
    m_log = _T("");
    m_r2 = _T("");
    m_regno = 0;
    m_c = _T("");
    m_c1 = _T("");
    m_city = _T("");
    m_state = _T("");
    //}}AFX_DATA_INIT
}
 void Scs::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(Scs)
    DDX_Control(pDX, IDC_LIST1, m_list);
    DDX_Text(pDX, IDC_EDIT1, m_n1);
    DDX_Text(pDX, IDC_EDIT2, m_n2);
    DDX_Text(pDX, IDC_EDIT3, m_n3);
    DDX_Text(pDX, IDC_EDIT4, m_r1);
    DDX_Text(pDX, IDC_list, m_r2);
    DDX_Text(pDX, IDC_regno, m_regno);
    DDX_CBString(pDX, IDC_COMBO3, m_c);
    DDX_CBString(pDX, IDC_COMBO4, m_c1);
    DDX_CBString(pDX, IDC_COMBO1, m_city);
    DDX_CBString(pDX, IDC_COMBO2, m_state);
    //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Scs, CDialog)
    //{{AFX_MSG_MAP(Scs)
    ON_BN_CLICKED(IDC_Scs, OnAdd)
    ON_BN_CLICKED(IDC_acc, Onacc)
    ON_BN_CLICKED(IDC_CHECK1, Onug)
    ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
    ON_BN_CLICKED(IDC_ADDED, OnAdded)
    ON_BN_CLICKED(IDC_submit, Onsubmit)
    ON_BN_CLICKED(IDC_reset, Onreset)
    ON_BN_CLICKED(IDC_allocate, Onallocate)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// scs message handlers
void Scs::OnAdd()
{
    // TODO: Add your control notification handler code here
    UpdateData(true);
     m_r1=m_n1+m_n2+m_n3;
    UpdateData(false); 
}
void Scs::Onacc()
{
    // TODO: Add your control notification handler code here
   if (m_r1/3>75)
          MessageBox("eligble for applying ",0,MB_OK);
    else
      MessageBox("Not eligble for applying ",0,MB_OK);
}
void Scs::OnSelchangeList1()
{
    // TODO: Add your control notification handler code here
    m_list.GetCurSel();
}
void Scs::OnAdded()
{
    // TODO: Add your control notification handler code here
 CString l;
 UpdateData(true);
 l=m_r2;
 m_list.AddString(l);
 UpdateData(false);
}
void Scs::Onsubmit()
{
    UpdateData(true);
    if(m_regno!=NULL && m_n1!=NULL && m_n2!=NULL && m_n3!=NULL)
        MessageBox("ur details are submitted","report",0|MB_ICONINFORMATION);
    else if(m_regno!=NULL && m_n1==m_n2==m_n3==NULL)
        MessageBox(" marks not submitted","report",0|MB_ICONERROR);
    else if(m_regno==NULL)
        MessageBox(" register number not submitted","report",0|MB_ICONERROR);
    else if(m_n1==NULL)
        MessageBox(" mark1 not submitted","report",0|MB_ICONERROR);
    else if(m_n2==NULL)
        MessageBox(" mark2 not submitted","report",0|MB_ICONERROR);
    else if(m_n3==NULL)
        MessageBox(" mark3 not submitted","report",0|MB_ICONERROR);
    UpdateData(false);       
}
void Scs::Onreset()
{
    // TODO: Add your control notification handler code here
    UpdateData(true);
    m_list.ResetContent();
    m_n1 = 0;
    m_n2 = 0;
    m_n3 = 0;
    m_r1 = 0;
    m_log = _T("");
    m_r2 = _T("");
    m_regno = 0;
    UpdateData(false);
}
void Scs::Onallocate()
{
    UpdateData(true);
    seat d;
    d.m_n=m_r2;
    d.m_rg=m_regno;
    d.m_dep=m_c;
    d.m_city=m_city;
    d.m_state=m_state;
    d.DoModal();   
    UpdateData(false);
}

studentView.cpp: implementation of the CStudentView class
#include "stdafx.h"
#include "student.h"
#include "studentDoc.h"
#include "studentView.h"
#include "Scs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStudentView
IMPLEMENT_DYNCREATE(CStudentView, CView)
BEGIN_MESSAGE_MAP(CStudentView, CView)
    //{{AFX_MSG_MAP(CStudentView)
    ON_WM_LBUTTONDOWN()
    //}}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()
/////////////////////////////////////////////////////////////////////////////
// CStudentView construction/destruction
CStudentView::CStudentView()
{
    // TODO: add construction code here

}
CStudentView::~CStudentView()
{
}
BOOL CStudentView::PreCreateWindow(CREATESTRUCT& cs)
{
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
    return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CStudentView drawing
void CStudentView::OnDraw(CDC* pDC)
{
    CStudentDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CStudentView printing
BOOL CStudentView::OnPreparePrinting(CPrintInfo* pInfo)
{
    // default preparation
    return DoPreparePrinting(pInfo);
}
void CStudentView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add extra initialization before printing
}
void CStudentView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CStudentView diagnostics
#ifdef _DEBUG
void CStudentView::AssertValid() const
{
    CView::AssertValid();
}
void CStudentView::Dump(CDumpContext& dc) const
{
    CView::Dump(dc);
}
CStudentDoc* CStudentView::GetDocument() // non-debug version is inline
{
    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStudentDoc)));
    return (CStudentDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CStudentView message handlers
void CStudentView::OnLButtonDown(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default 
    CView::OnLButtonDown(nFlags, point);
        Scs a;
    a.DoModal();
}

OUTPUT:
Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: