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

  1. // ipdrive.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 "ipdrive.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "ipdridoc.h"
  18. #include "ipdrivw.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CDriveApp
  27.  
  28. BEGIN_MESSAGE_MAP(CDriveApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CDriveApp)
  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. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CDriveApp construction
  41.  
  42. CDriveApp::CDriveApp()
  43. {
  44.     // TODO: add construction code here,
  45.     // Place all significant initialization in InitInstance
  46. }
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // The one and only CDriveApp object
  50.  
  51. CDriveApp NEAR theApp;
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CDriveApp initialization
  55.  
  56. BOOL CDriveApp::InitInstance()
  57. {
  58.     // Initialize OLE libraries
  59.     if (!AfxOleInit())
  60.     {
  61.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  62.         return FALSE;
  63.     }
  64.  
  65.     // Standard initialization
  66.     // If you are not using these features and wish to reduce the size
  67.     //  of your final executable, you should remove from the following
  68.     //  the specific initialization routines you do not need.
  69.  
  70. #if (_MFC_VER >= 0x300)
  71.     Enable3dControls();
  72. #else
  73.     SetDialogBkColor();
  74. #endif    
  75.  
  76.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  77.  
  78.     // Register the application's document templates.  Document templates
  79.     //  serve as the connection between documents, frame windows and views.
  80.  
  81.     CSingleDocTemplate* pDocTemplate;
  82.     pDocTemplate = new CSingleDocTemplate(
  83.         IDR_MAINFRAME,
  84.         RUNTIME_CLASS(CDriverDoc),
  85.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  86.         RUNTIME_CLASS(CDriverView));
  87.     AddDocTemplate(pDocTemplate);
  88.  
  89.     // create a new (empty) document
  90.     OnFileNew();
  91.  
  92.     if (m_lpCmdLine[0] != '\0')
  93.     {
  94.         // TODO: add command line processing here
  95.     }
  96.  
  97. #ifdef _MAC
  98.     // Enable drag/drop open
  99.     m_pMainWnd->DragAcceptFiles();
  100. #endif
  101.  
  102.     return TRUE;
  103. }
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CAboutDlg dialog used for App About
  107.  
  108. class CAboutDlg : public CDialog
  109. {
  110. public:
  111.     CAboutDlg();
  112.  
  113. // Dialog Data
  114.     //{{AFX_DATA(CAboutDlg)
  115.     enum { IDD = IDD_ABOUTBOX };
  116.     //}}AFX_DATA
  117.  
  118. // Implementation
  119. protected:
  120.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  121.     //{{AFX_MSG(CAboutDlg)
  122.         // No message handlers
  123.     //}}AFX_MSG
  124.     DECLARE_MESSAGE_MAP()
  125. };
  126.  
  127. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  128. {
  129.     //{{AFX_DATA_INIT(CAboutDlg)
  130.     //}}AFX_DATA_INIT
  131. }
  132.  
  133. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  134. {
  135.     CDialog::DoDataExchange(pDX);
  136.     //{{AFX_DATA_MAP(CAboutDlg)
  137.     //}}AFX_DATA_MAP
  138. }
  139.  
  140. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  141.     //{{AFX_MSG_MAP(CAboutDlg)
  142.         // No message handlers
  143.     //}}AFX_MSG_MAP
  144. END_MESSAGE_MAP()
  145.  
  146. // App command to run the dialog
  147. void CDriveApp::OnAppAbout()
  148. {
  149.     CAboutDlg aboutDlg;
  150.     aboutDlg.DoModal();
  151. }
  152.  
  153. /////////////////////////////////////////////////////////////////////////////
  154. // CDriveApp commands
  155.