home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c05 / statbar / statbar.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  3.5 KB  |  134 lines

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