home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 1 / WINDOWS95_1.bin / internet / vogon / vogon.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-22  |  4.0 KB  |  155 lines

  1. // vogon.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vogon.h"
  6.  
  7. #include "CntrInfo.h"
  8. #include "CntrItem.h"
  9. #include "mainfrm.h"
  10. #include "vogondoc.h"
  11. #include "vogonvw.h"
  12.  
  13. // CONTAIN DOES THIS, so do we (was not required for props or methods, we are adding events)
  14. #include <initguid.h>
  15. #include <olectlid.h>
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CVogonApp
  24.  
  25. BEGIN_MESSAGE_MAP(CVogonApp, CWinApp)
  26.     //{{AFX_MSG_MAP(CVogonApp)
  27.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  28.         // NOTE - the ClassWizard will add and remove mapping macros here.
  29.         //    DO NOT EDIT what you see in these blocks of generated code!
  30.     //}}AFX_MSG_MAP
  31.     // Standard file based document commands
  32.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  33.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CVogonApp construction
  38.  
  39. CVogonApp::CVogonApp()
  40. {
  41.     // TODO: add construction code here,
  42.     // Place all significant initialization in InitInstance
  43. }
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // The one and only CVogonApp object
  47.  
  48. CVogonApp NEAR theApp;
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CVogonApp initialization
  52.  
  53. BOOL CVogonApp::InitInstance()
  54. {
  55.     // Initialize OLE 2.0 libraries
  56.     if (!AfxOleInit())
  57.     {
  58.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  59.         return FALSE;
  60.     }
  61.  
  62.     // Standard initialization
  63.     // If you are not using these features and wish to reduce the size
  64.     //  of your final executable, you should remove from the following
  65.     //  the specific initialization routines you do not need.
  66.  
  67.     SetDialogBkColor();        // Set dialog background color to gray
  68.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  69.  
  70.     // Register the application's document templates.  Document templates
  71.     //  serve as the connection between documents, frame windows and views.
  72.  
  73.     CMultiDocTemplate* pDocTemplate;
  74.     pDocTemplate = new CMultiDocTemplate(
  75.         IDR_VOGONTYPE,
  76.         RUNTIME_CLASS(CVogonDoc),
  77.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  78.         RUNTIME_CLASS(CVogonView));
  79.     pDocTemplate->SetContainerInfo(IDR_VOGONTYPE_CNTR_IP);
  80.     AddDocTemplate(pDocTemplate);
  81.  
  82.     // create main MDI Frame window
  83.     CMainFrame* pMainFrame = new CMainFrame;
  84.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  85.         return FALSE;
  86.     m_pMainWnd = pMainFrame;
  87.  
  88.    // Do we have a command line ?
  89.     if (m_lpCmdLine[0] != '\0')
  90.     {  // Command line contains a file name to open
  91.       OpenDocumentFile(m_lpCmdLine);
  92.     }
  93.    else
  94.    {  // create a new (empty) document
  95.        OnFileNew();
  96.    }
  97.  
  98.     // The main window has been initialized, so show and update it.
  99.     pMainFrame->ShowWindow(m_nCmdShow);
  100.     pMainFrame->UpdateWindow();
  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 CVogonApp::OnAppAbout()
  148. {
  149.     CAboutDlg aboutDlg;
  150.     aboutDlg.DoModal();
  151. }
  152.  
  153. /////////////////////////////////////////////////////////////////////////////
  154. // CVogonApp commands
  155.