home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c09 / lab01 / ex01 / employee.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  3.5 KB  |  141 lines

  1. // Employee.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Employee.h"
  6.  
  7. #include "MainFrm.h"
  8.  
  9. #include "EmployeePersonalSet.h"
  10. #include "EmployeePaySet.h"
  11.  
  12. #include "EmployeeDoc.h"
  13. #include "EmployeeView.h"
  14.  
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CEmployeeApp
  23.  
  24. BEGIN_MESSAGE_MAP(CEmployeeApp, CWinApp)
  25.     //{{AFX_MSG_MAP(CEmployeeApp)
  26.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  27.         // NOTE - the ClassWizard will add and remove mapping macros here.
  28.         //    DO NOT EDIT what you see in these blocks of generated code!
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CEmployeeApp construction
  34.  
  35. CEmployeeApp::CEmployeeApp()
  36. {
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // The one and only CEmployeeApp object
  41.  
  42. CEmployeeApp theApp;
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CEmployeeApp initialization
  46.  
  47. BOOL CEmployeeApp::InitInstance()
  48. {
  49.     AfxEnableControlContainer();
  50.  
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56. #ifdef _AFXDLL
  57.     Enable3dControls();            // Call this when using MFC in a shared DLL
  58. #else
  59.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  60. #endif
  61.  
  62.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  63.  
  64.     // Register the application's document templates.  Document templates
  65.     //  serve as the connection between documents, frame windows and views.
  66.  
  67.     CSingleDocTemplate* pDocTemplate;
  68.     pDocTemplate = new CSingleDocTemplate(
  69.         IDR_MAINFRAME,
  70.         RUNTIME_CLASS(CEmployeeDoc),
  71.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  72.         RUNTIME_CLASS(CEmployeeView));
  73.     AddDocTemplate(pDocTemplate);
  74.  
  75.     // Parse command line for standard shell commands, DDE, file open
  76.     CCommandLineInfo cmdInfo;
  77.     ParseCommandLine(cmdInfo);
  78.  
  79.     // Dispatch commands specified on the command line
  80.     if (!ProcessShellCommand(cmdInfo))
  81.         return FALSE;
  82.  
  83.     return TRUE;
  84. }
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CAboutDlg dialog used for App About
  88.  
  89. class CAboutDlg : public CDialog
  90. {
  91. public:
  92.     CAboutDlg();
  93.  
  94. // Dialog Data
  95.     //{{AFX_DATA(CAboutDlg)
  96.     enum { IDD = IDD_ABOUTBOX };
  97.     //}}AFX_DATA
  98.  
  99.     // ClassWizard generated virtual function overrides
  100.     //{{AFX_VIRTUAL(CAboutDlg)
  101.     protected:
  102.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  103.     //}}AFX_VIRTUAL
  104.  
  105. // Implementation
  106. protected:
  107.     //{{AFX_MSG(CAboutDlg)
  108.         // No message handlers
  109.     //}}AFX_MSG
  110.     DECLARE_MESSAGE_MAP()
  111. };
  112.  
  113. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  114. {
  115.     //{{AFX_DATA_INIT(CAboutDlg)
  116.     //}}AFX_DATA_INIT
  117. }
  118.  
  119. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  120. {
  121.     CDialog::DoDataExchange(pDX);
  122.     //{{AFX_DATA_MAP(CAboutDlg)
  123.     //}}AFX_DATA_MAP
  124. }
  125.  
  126. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  127.     //{{AFX_MSG_MAP(CAboutDlg)
  128.         // No message handlers
  129.     //}}AFX_MSG_MAP
  130. END_MESSAGE_MAP()
  131.  
  132. // App command to run the dialog
  133. void CEmployeeApp::OnAppAbout()
  134. {
  135.     CAboutDlg aboutDlg;
  136.     aboutDlg.DoModal();
  137. }
  138.  
  139. /////////////////////////////////////////////////////////////////////////////
  140. // CEmployeeApp commands
  141.