home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OLDBARS.PAK / OLDBARS.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  4.3 KB  |  160 lines

  1. // oldbars.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "oldbars.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "oldbadoc.h"
  18. #include "oldbavw.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // COldbarsApp
  27.  
  28. BEGIN_MESSAGE_MAP(COldbarsApp, CWinApp)
  29.     //{{AFX_MSG_MAP(COldbarsApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.         // NOTE - the ClassWizard will add and remove mapping macros here.
  32.         //    DO NOT EDIT what you see in these blocks of generated code!
  33.     //}}AFX_MSG_MAP
  34.     // Standard file based document commands
  35.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  36.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  37.     // Standard print setup command
  38.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  39. END_MESSAGE_MAP()
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // COldbarsApp construction
  43.  
  44. COldbarsApp::COldbarsApp()
  45. {
  46.     // TODO: add construction code here,
  47.     // Place all significant initialization in InitInstance
  48. }
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // The one and only COldbarsApp object
  52.  
  53. COldbarsApp theApp;
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // COldbarsApp initialization
  57.  
  58. BOOL COldbarsApp::InitInstance()
  59. {
  60.     // Standard initialization
  61.     // If you are not using these features and wish to reduce the size
  62.     //  of your final executable, you should remove from the following
  63.     //  the specific initialization routines you do not need.
  64.  
  65.     Enable3dControls();
  66.  
  67.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  68.  
  69.     // Register the application's document templates.  Document templates
  70.     //  serve as the connection between documents, frame windows and views.
  71.  
  72.     CMultiDocTemplate* pDocTemplate;
  73.     pDocTemplate = new CMultiDocTemplate(
  74.         IDR_OLDBARTYPE,
  75.         RUNTIME_CLASS(COldbarsDoc),
  76.         RUNTIME_CLASS(CMDIChildWnd),          // standard MDI child frame
  77.         RUNTIME_CLASS(COldbarsView));
  78.     AddDocTemplate(pDocTemplate);
  79.  
  80.     // create main MDI Frame window
  81.     CMainFrame* pMainFrame = new CMainFrame;
  82.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  83.         return FALSE;
  84.     m_pMainWnd = pMainFrame;
  85.  
  86.     // create a new (empty) document
  87. #ifndef _MAC
  88.     // On the Macintosh, this call isn't required, since the Finder is
  89.     //  already sending the app a message to open a new document.
  90.     OnFileNew();
  91. #endif
  92.  
  93.     if (m_lpCmdLine[0] != '\0')
  94.     {
  95.         // TODO: add command line processing here
  96.     }
  97.  
  98. #ifdef _MAC
  99.     // Enable drag/drop open
  100.     m_pMainWnd->DragAcceptFiles();
  101. #endif
  102.  
  103.     // The main window has been initialized, so show and update it.
  104.     pMainFrame->ShowWindow(m_nCmdShow);
  105.     pMainFrame->UpdateWindow();
  106.  
  107.     return TRUE;
  108. }
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CAboutDlg dialog used for App About
  112.  
  113. class CAboutDlg : public CDialog
  114. {
  115. public:
  116.     CAboutDlg();
  117.  
  118. // Dialog Data
  119.     //{{AFX_DATA(CAboutDlg)
  120.     enum { IDD = IDD_ABOUTBOX };
  121.     //}}AFX_DATA
  122.  
  123. // Implementation
  124. protected:
  125.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  126.     //{{AFX_MSG(CAboutDlg)
  127.         // No message handlers
  128.     //}}AFX_MSG
  129.     DECLARE_MESSAGE_MAP()
  130. };
  131.  
  132. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  133. {
  134.     //{{AFX_DATA_INIT(CAboutDlg)
  135.     //}}AFX_DATA_INIT
  136. }
  137.  
  138. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  139. {
  140.     CDialog::DoDataExchange(pDX);
  141.     //{{AFX_DATA_MAP(CAboutDlg)
  142.     //}}AFX_DATA_MAP
  143. }
  144.  
  145. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  146.     //{{AFX_MSG_MAP(CAboutDlg)
  147.         // No message handlers
  148.     //}}AFX_MSG_MAP
  149. END_MESSAGE_MAP()
  150.  
  151. // App command to run the dialog
  152. void COldbarsApp::OnAppAbout()
  153. {
  154.     CAboutDlg aboutDlg;
  155.     aboutDlg.DoModal();
  156. }
  157.  
  158. /////////////////////////////////////////////////////////////////////////////
  159. // COldbarsApp commands
  160.