home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / tutorial / enroll / step4 / enroll.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  4KB  |  142 lines

  1. // Enroll.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Enroll.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "SectSet.h"
  9. #include "coursset.h"
  10. #include "enroldoc.h"
  11. #include "addform.h"
  12. #include "SectForm.h"
  13.  
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CEnrollApp
  22.  
  23. BEGIN_MESSAGE_MAP(CEnrollApp, CWinApp)
  24.     //{{AFX_MSG_MAP(CEnrollApp)
  25.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  26.         // NOTE - the ClassWizard will add and remove mapping macros here.
  27.         //    DO NOT EDIT what you see in these blocks of generated code!
  28.     //}}AFX_MSG_MAP
  29.     // Standard print setup command
  30.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CEnrollApp construction
  35.  
  36. CEnrollApp::CEnrollApp()
  37. {
  38.     // TODO: add construction code here,
  39.     // Place all significant initialization in InitInstance
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CEnrollApp object
  44.  
  45. CEnrollApp theApp;
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CEnrollApp initialization
  49.  
  50. BOOL CEnrollApp::InitInstance()
  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(CEnrollDoc),
  72.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  73.         RUNTIME_CLASS(CSectionForm));
  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 CEnrollApp::OnAppAbout()
  135. {
  136.     CAboutDlg aboutDlg;
  137.     aboutDlg.DoModal();
  138. }
  139.  
  140. /////////////////////////////////////////////////////////////////////////////
  141. // CEnrollApp commands
  142.