home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / vcterm / vcterm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  3.4 KB  |  133 lines

  1. // vcterm.cpp : implementation of the CVCTermApp class
  2. //
  3.  
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992-1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #include "stdafx.h"
  15. #include "vcterm.h"
  16. #include "mainfrm.h"
  17.  
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CVCTermApp
  26.  
  27. BEGIN_MESSAGE_MAP(CVCTermApp, CWinApp)
  28.     //{{AFX_MSG_MAP(CVCTermApp)
  29.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  30.         // NOTE - the ClassWizard will add and remove mapping macros here.
  31.         //    DO NOT EDIT what you see in these blocks of generated code!
  32.     //}}AFX_MSG_MAP
  33.     // Standard file based document commands
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CVCTermApp construction
  38.  
  39. CVCTermApp::CVCTermApp()
  40. {
  41.     // TODO: add construction code here,
  42.     // Place all significant initialization in InitInstance
  43. }
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // The one and only CVCTermApp object
  47.  
  48. CVCTermApp theApp;
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CVCTermApp initialization
  52.  
  53. BOOL CVCTermApp::InitInstance()
  54. {
  55.     AfxEnableControlContainer();
  56.  
  57.     // Standard initialization
  58.     // If you are not using these features and wish to reduce the size
  59.     // of your final executable, you should remove from the following
  60.     // the specific initialization routines you do not need.
  61.  
  62. #ifdef _AFXDLL
  63.     Enable3dControls();         // Call this when using MFC in a shared DLL
  64. #else
  65.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  66. #endif
  67.  
  68.     CMainFrame* pMainFrame = new CMainFrame;
  69.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  70.         return FALSE;
  71.     m_pMainWnd = pMainFrame;
  72.     m_pMainWnd->ShowWindow(m_nCmdShow);
  73.     m_pMainWnd->UpdateWindow();
  74.  
  75.     return TRUE;
  76. }
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79. // CAboutDlg dialog used for App About
  80.  
  81. class CAboutDlg : public CDialog
  82. {
  83. public:
  84.     CAboutDlg();
  85.  
  86. // Dialog Data
  87.     //{{AFX_DATA(CAboutDlg)
  88.     enum { IDD = IDD_ABOUTBOX };
  89.     //}}AFX_DATA
  90.  
  91.     // ClassWizard generated virtual function overrides
  92.     //{{AFX_VIRTUAL(CAboutDlg)
  93.     protected:
  94.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  95.     //}}AFX_VIRTUAL
  96.  
  97. // Implementation
  98. protected:
  99.     //{{AFX_MSG(CAboutDlg)
  100.         // No message handlers
  101.     //}}AFX_MSG
  102.     DECLARE_MESSAGE_MAP()
  103. };
  104.  
  105. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  106. {
  107.     //{{AFX_DATA_INIT(CAboutDlg)
  108.     //}}AFX_DATA_INIT
  109. }
  110.  
  111. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  112. {
  113.     CDialog::DoDataExchange(pDX);
  114.     //{{AFX_DATA_MAP(CAboutDlg)
  115.     //}}AFX_DATA_MAP
  116. }
  117.  
  118. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  119.     //{{AFX_MSG_MAP(CAboutDlg)
  120.         // No message handlers
  121.     //}}AFX_MSG_MAP
  122. END_MESSAGE_MAP()
  123.  
  124. // App command to run the dialog
  125. void CVCTermApp::OnAppAbout()
  126. {
  127.     CAboutDlg aboutDlg;
  128.     aboutDlg.DoModal();
  129. }
  130.  
  131. /////////////////////////////////////////////////////////////////////////////
  132. // CVCTermApp commands
  133.