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