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

  1. // splitter.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "splitter.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "SplitDoc.h"
  9. #include "spltView.h"
  10. #include "ItalView.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. // CSplitterApp
  20.  
  21. BEGIN_MESSAGE_MAP(CSplitterApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CSplitterApp)
  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 file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CSplitterApp construction
  34.  
  35. CSplitterApp::CSplitterApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CSplitterApp object
  43.  
  44. CSplitterApp theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CSplitterApp initialization
  48.  
  49. BOOL CSplitterApp::InitInstance()
  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.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  57.  
  58.     // Register the application's document templates.  Document templates
  59.     //  serve as the connection between documents, frame windows and views.
  60.  
  61.     CSingleDocTemplate* pDocTemplate;
  62.     pDocTemplate = new CSingleDocTemplate(
  63.         IDR_MAINFRAME,
  64.         RUNTIME_CLASS(CSplitterDoc),
  65.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  66.         RUNTIME_CLASS(CSplitterView));
  67.     AddDocTemplate(pDocTemplate);
  68.  
  69.     // Parse command line for standard shell commands, DDE, file open
  70.     CCommandLineInfo cmdInfo;
  71.     ParseCommandLine(cmdInfo);
  72.  
  73.     // Dispatch commands specified on the command line
  74.     if (!ProcessShellCommand(cmdInfo))
  75.         return FALSE;
  76.  
  77.     return TRUE;
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CAboutDlg dialog used for App About
  82.  
  83. class CAboutDlg : public CDialog
  84. {
  85. public:
  86.     CAboutDlg();
  87.  
  88. // Dialog Data
  89.     //{{AFX_DATA(CAboutDlg)
  90.     enum { IDD = IDD_ABOUTBOX };
  91.     //}}AFX_DATA
  92.  
  93.     // ClassWizard generated virtual function overrides
  94.     //{{AFX_VIRTUAL(CAboutDlg)
  95.     protected:
  96.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  97.     //}}AFX_VIRTUAL
  98.  
  99. // Implementation
  100. protected:
  101.     //{{AFX_MSG(CAboutDlg)
  102.         // No message handlers
  103.     //}}AFX_MSG
  104.     DECLARE_MESSAGE_MAP()
  105. };
  106.  
  107. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  108. {
  109.     //{{AFX_DATA_INIT(CAboutDlg)
  110.     //}}AFX_DATA_INIT
  111. }
  112.  
  113. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  114. {
  115.     CDialog::DoDataExchange(pDX);
  116.     //{{AFX_DATA_MAP(CAboutDlg)
  117.     //}}AFX_DATA_MAP
  118. }
  119.  
  120. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  121.     //{{AFX_MSG_MAP(CAboutDlg)
  122.         // No message handlers
  123.     //}}AFX_MSG_MAP
  124. END_MESSAGE_MAP()
  125.  
  126. // App command to run the dialog
  127. void CSplitterApp::OnAppAbout()
  128. {
  129.     CAboutDlg aboutDlg;
  130.     aboutDlg.DoModal();
  131. }
  132.  
  133. /////////////////////////////////////////////////////////////////////////////
  134. // CSplitterApp commands
  135.