home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / CONTAIN / CONTAIN.ARJ / CONTAIN.CPP < prev    next >
C/C++ Source or Header  |  1994-01-06  |  5KB  |  166 lines

  1. // contain.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "contain.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "contadoc.h"
  9. #include "contavw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CContainApp
  18.  
  19. BEGIN_MESSAGE_MAP(CContainApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CContainApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28.     // Standard print setup command
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CContainApp construction
  34.  
  35. CContainApp::CContainApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CContainApp object
  43.  
  44. CContainApp NEAR theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CContainApp initialization
  48.  
  49. BOOL CContainApp::InitInstance()
  50. {
  51.     // Initialize OLE 2.0 libraries
  52.     if (!AfxOleInit())
  53.     {
  54.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  55.         return FALSE;
  56.     }
  57.  
  58.     // Standard initialization
  59.     // If you are not using these features and wish to reduce the size
  60.     //  of your final executable, you should remove from the following
  61.     //  the specific initialization routines you do not need.
  62.  
  63.     SetDialogBkColor();        // Set dialog background color to gray
  64.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  65.     EnableVBX();               // Initialize VBX support
  66.  
  67.     // Register the application's document templates.  Document templates
  68.     //  serve as the connection between documents, frame windows and views.
  69.  
  70.     CMultiDocTemplate* pDocTemplate;
  71.     pDocTemplate = new CMultiDocTemplate(
  72.         IDR_CNTAINTYPE,
  73.         RUNTIME_CLASS(CContainDoc),
  74.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  75.         RUNTIME_CLASS(CContainView));
  76.     pDocTemplate->SetContainerInfo(IDR_CNTAINTYPE_CNTR_IP);
  77.     AddDocTemplate(pDocTemplate);
  78.  
  79.     // create main MDI Frame window
  80.     CMainFrame* pMainFrame = new CMainFrame;
  81.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  82.         return FALSE;
  83.     m_pMainWnd = pMainFrame;
  84.  
  85.     // enable file manager drag/drop and DDE Execute open
  86.     EnableShellOpen();
  87.     RegisterShellFileTypes();
  88.  
  89.     // simple command line parsing
  90.     if (m_lpCmdLine[0] == '\0')
  91.     {
  92.         //AfxMessageBox("OnFileNew");// create a new (empty) document
  93.         OnFileNew();
  94.     }
  95.     else
  96.     {
  97.         // open an existing document
  98.         OpenDocumentFile(m_lpCmdLine);
  99.     }
  100.  
  101.     m_pMainWnd->DragAcceptFiles();
  102.     // The main window has been initialized, so show and update it.
  103.     pMainFrame->ShowWindow(m_nCmdShow);
  104.     pMainFrame->UpdateWindow();
  105.  
  106.     return TRUE;
  107. }
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CAboutDlg dialog used for App About
  111.  
  112. class CAboutDlg : public CDialog
  113. {
  114. public:
  115.     CAboutDlg();
  116.  
  117. // Dialog Data
  118.     //{{AFX_DATA(CAboutDlg)
  119.     enum { IDD = IDD_ABOUTBOX };
  120.     //}}AFX_DATA
  121.  
  122. // Implementation
  123. protected:
  124.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  125.     //{{AFX_MSG(CAboutDlg)
  126.         // No message handlers
  127.     //}}AFX_MSG
  128.     DECLARE_MESSAGE_MAP()
  129. };
  130.  
  131. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  132. {
  133.     //{{AFX_DATA_INIT(CAboutDlg)
  134.     //}}AFX_DATA_INIT
  135. }
  136.  
  137. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  138. {
  139.     CDialog::DoDataExchange(pDX);
  140.     //{{AFX_DATA_MAP(CAboutDlg)
  141.     //}}AFX_DATA_MAP
  142. }
  143.  
  144. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  145.     //{{AFX_MSG_MAP(CAboutDlg)
  146.         // No message handlers
  147.     //}}AFX_MSG_MAP
  148. END_MESSAGE_MAP()
  149.  
  150. // App command to run the dialog
  151. void CContainApp::OnAppAbout()
  152. {
  153.     CAboutDlg aboutDlg;
  154.     aboutDlg.DoModal();
  155. }
  156.  
  157. /////////////////////////////////////////////////////////////////////////////
  158. // VB-Event registration
  159. // (calls to AfxRegisterVBEvent will be placed here by ClassWizard)
  160.  
  161. //{{AFX_VBX_REGISTER_MAP()
  162. //}}AFX_VBX_REGISTER_MAP
  163.  
  164. /////////////////////////////////////////////////////////////////////////////
  165. // CContainApp commands
  166.