home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / dcom / atldraw / atldraw.cpp < prev    next >
C/C++ Source or Header  |  1998-04-02  |  4KB  |  151 lines

  1. // ATLDraw.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the ActiveX Template Library.
  4. // Copyright (C) 1996 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // ActiveX Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // ActiveX Template Library product.
  12.  
  13. #include "preatldr.h"
  14. #include "ATLDraw.h"
  15.  
  16. #include "MainFrm.h"
  17. #include "ATLDDoc.h"
  18. #include "ATLDView.h"
  19.  
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CATLDrawApp
  28.  
  29. BEGIN_MESSAGE_MAP(CATLDrawApp, CWinApp)
  30.     //{{AFX_MSG_MAP(CATLDrawApp)
  31.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  32.         // NOTE - the ClassWizard will add and remove mapping macros here.
  33.         //    DO NOT EDIT what you see in these blocks of generated code!
  34.     //}}AFX_MSG_MAP
  35.     // Standard file based document commands
  36.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  37.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  38.     // Standard print setup command
  39.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  40. END_MESSAGE_MAP()
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CATLDrawApp construction
  44.  
  45. CATLDrawApp::CATLDrawApp()
  46. {
  47.     // TODO: add construction code here,
  48.     // Place all significant initialization in InitInstance
  49. }
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // The one and only CATLDrawApp object
  53.  
  54. CATLDrawApp theApp;
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CATLDrawApp initialization
  58.  
  59. BOOL CATLDrawApp::InitInstance()
  60. {
  61.     // Standard initialization
  62.     // If you are not using these features and wish to reduce the size
  63.     //  of your final executable, you should remove from the following
  64.     //  the specific initialization routines you do not need.
  65.  
  66. #ifdef _AFXDLL
  67.     Enable3dControls();         // Call this when using MFC in a shared DLL
  68. #else
  69.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  70. #endif
  71.  
  72.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  73.  
  74.     // Register the application's document templates.  Document templates
  75.     //  serve as the connection between documents, frame windows and views.
  76.  
  77.     CSingleDocTemplate* pDocTemplate;
  78.     pDocTemplate = new CSingleDocTemplate(
  79.         IDR_MAINFRAME,
  80.         RUNTIME_CLASS(CATLDrawDoc),
  81.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  82.         RUNTIME_CLASS(CATLDrawView));
  83.     AddDocTemplate(pDocTemplate);
  84.  
  85.     // Parse command line for standard shell commands, DDE, file open
  86.     CCommandLineInfo cmdInfo;
  87.     ParseCommandLine(cmdInfo);
  88.  
  89.     // Dispatch commands specified on the command line
  90.     if (!ProcessShellCommand(cmdInfo))
  91.         return FALSE;
  92.  
  93.     return TRUE;
  94. }
  95.  
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CAboutDlg dialog used for App About
  98.  
  99. class CAboutDlg : public CDialog
  100. {
  101. public:
  102.     CAboutDlg();
  103.  
  104. // Dialog Data
  105.     //{{AFX_DATA(CAboutDlg)
  106.     enum { IDD = IDD_ABOUTBOX };
  107.     //}}AFX_DATA
  108.  
  109.     // ClassWizard generated virtual function overrides
  110.     //{{AFX_VIRTUAL(CAboutDlg)
  111.     protected:
  112.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  113.     //}}AFX_VIRTUAL
  114.  
  115. // Implementation
  116. protected:
  117.     //{{AFX_MSG(CAboutDlg)
  118.         // No message handlers
  119.     //}}AFX_MSG
  120.     DECLARE_MESSAGE_MAP()
  121. };
  122.  
  123. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  124. {
  125.     //{{AFX_DATA_INIT(CAboutDlg)
  126.     //}}AFX_DATA_INIT
  127. }
  128.  
  129. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  130. {
  131.     CDialog::DoDataExchange(pDX);
  132.     //{{AFX_DATA_MAP(CAboutDlg)
  133.     //}}AFX_DATA_MAP
  134. }
  135.  
  136. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  137.     //{{AFX_MSG_MAP(CAboutDlg)
  138.         // No message handlers
  139.     //}}AFX_MSG_MAP
  140. END_MESSAGE_MAP()
  141.  
  142. // App command to run the dialog
  143. void CATLDrawApp::OnAppAbout()
  144. {
  145.     CAboutDlg aboutDlg;
  146.     aboutDlg.DoModal();
  147. }
  148.  
  149. /////////////////////////////////////////////////////////////////////////////
  150. // CATLDrawApp commands
  151.