Staff Details Example Program in VC++

#include<afxwin.h>
#include"resource.h"

class Dialog : public CDialog {
public:
   CString Name, Number, Address, Qualif, Dest, Display;

   Dialog(int n) : CDialog(n) {
   }

   int OnInitDialog() {
      CDialog::OnInitDialog();
      SetDlgItemText(IDC_EDIT1, "");
      SetDlgItemText(IDC_EDIT2, "");
      SetDlgItemText(IDC_EDIT3, "");
      CheckRadioButton(IDC_RADIO1, IDC_RADIO2, IDC_RADIO3);
      CheckDlgButton(IDC_CHECK1, 1);
      CheckDlgButton(IDC_CHECK2, 1);
      CheckDlgButton(IDC_CHECK3, 1);
      return TRUE;
   }

   void OnOK() {
      CDialog::OnOK();
      Fetch();
      ResultDisplay();
   }

   void Fetch() {
      GetDlgItemText(IDC_EDIT1, Name);
      GetDlgItemText(IDC_EDIT2, Number);
      GetDlgItemText(IDC_EDIT3, Address);

      int Check = GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3);
      switch (Check) {
         case IDC_RADIO1:Qualif = "MCA";
            break;
         case IDC_RADIO2:Qualif = "ME";
            break;
         case IDC_RADIO3:Qualif = "Phd";
            break;
      }

      if (IsDlgButtonChecked(IDC_CHECK1) == 1)
         Dest = "Analysist";
      if (IsDlgButtonChecked(IDC_CHECK2) == 1)
         Dest = "Tester";
      if (IsDlgButtonChecked(IDC_CHECK3) == 1)
         Dest = "Projgrammer";
   }

   void ResultDisplay() {
      Display = "\nStaff Details  :\n\n";
      Display += "\nStaff Name  :" + Name;
      Display += "\nStaff Number  :" + Number;
      Display += "\nStaff Address  :" + Address;
      Display += "\nStaff Qualification  :" + Qualif;
      Display += "\nStaff Destination  :" + Dest;
      MessageBox(Display);
   }

   void OnCancel() {
      CDialog::OnCancel();
      MessageBox("Cancelled", "Oncancel handlers");
   }
};

class Frame : public CFrameWnd {
public:
Frame() {
      Create(0, "Dialog", WS_OVERLAPPEDWINDOW, rectDefault, 0, MAKEINTRESOURCE(IDR_MENU1));
   }

   void OpenForm() {
      Dialog Run(IDD_DIALOG1);
      Run.DoModal();
   }

   DECLARE_MESSAGE_MAP();
};

BEGIN_MESSAGE_MAP(Frame, CFrameWnd)
ON_COMMAND(40001, OpenForm)
END_MESSAGE_MAP()


class Applet : public CWinApp {
public:

   int InitInstance() {
      Frame *Pointer = new Frame();
      Pointer->ShowWindow(3);
      m_pMainWnd = Pointer;
      return true;
   }
};
Applet Instance;