Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
3.9 KiB

  1. // MFC_DEMO.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "MFC_DEMO.h"
  5. #include "MainFrm.h"
  6. #include "DEMODoc.h"
  7. #include "DEMOView.h"
  8. #include <wintab.h>
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMFC_DEMOApp
  16. BEGIN_MESSAGE_MAP(CMFC_DEMOApp, CWinApp)
  17. //{{AFX_MSG_MAP(CMFC_DEMOApp)
  18. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  19. // NOTE - the ClassWizard will add and remove mapping macros here.
  20. // DO NOT EDIT what you see in these blocks of generated code!
  21. //}}AFX_MSG_MAP
  22. // Standard file based document commands
  23. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  24. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CMFC_DEMOApp construction
  28. CMFC_DEMOApp::CMFC_DEMOApp()
  29. {
  30. // TODO: add construction code here,
  31. // Place all significant initialization in InitInstance
  32. }
  33. /////////////////////////////////////////////////////////////////////////////
  34. // The one and only CMFC_DEMOApp object
  35. CMFC_DEMOApp theApp;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CMFC_DEMOApp initialization
  38. BOOL CMFC_DEMOApp::InitInstance()
  39. {
  40. // Check if Wintab is available
  41. if (!WTInfo(0, 0, NULL)) {
  42. return FALSE;
  43. }
  44. #ifdef _AFXDLL
  45. Enable3dControls(); // Call this when using MFC in a shared DLL
  46. #else
  47. Enable3dControlsStatic(); // Call this when linking to MFC statically
  48. #endif
  49. // Change the registry key under which our settings are stored.
  50. // You should modify this string to be something appropriate
  51. // such as the name of your company or organization.
  52. SetRegistryKey(_T("LCS/Telegraphics"));
  53. LoadStdProfileSettings(); // Load standard INI file options (including MRU)
  54. // Register the application's document templates. Document templates
  55. // serve as the connection between documents, frame windows and views.
  56. CSingleDocTemplate* pDocTemplate;
  57. pDocTemplate = new CSingleDocTemplate(
  58. IDR_MAINFRAME,
  59. RUNTIME_CLASS(CMFC_DEMODoc),
  60. RUNTIME_CLASS(CMainFrame), // main SDI frame window
  61. RUNTIME_CLASS(CMFC_DEMOView));
  62. AddDocTemplate(pDocTemplate);
  63. // Parse command line for standard shell commands, DDE, file open
  64. CCommandLineInfo cmdInfo;
  65. ParseCommandLine(cmdInfo);
  66. // Dispatch commands specified on the command line
  67. if (!ProcessShellCommand(cmdInfo))
  68. return FALSE;
  69. // The one and only window has been initialized, so show and update it.
  70. m_pMainWnd->ShowWindow(SW_SHOW);
  71. m_pMainWnd->UpdateWindow();
  72. return TRUE;
  73. }
  74. /////////////////////////////////////////////////////////////////////////////
  75. // CAboutDlg dialog used for App About
  76. class CAboutDlg : public CDialog
  77. {
  78. public:
  79. CAboutDlg();
  80. // Dialog Data
  81. //{{AFX_DATA(CAboutDlg)
  82. enum { IDD = IDD_ABOUTBOX };
  83. //}}AFX_DATA
  84. // ClassWizard generated virtual function overrides
  85. //{{AFX_VIRTUAL(CAboutDlg)
  86. protected:
  87. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  88. //}}AFX_VIRTUAL
  89. // Implementation
  90. protected:
  91. //{{AFX_MSG(CAboutDlg)
  92. // No message handlers
  93. //}}AFX_MSG
  94. DECLARE_MESSAGE_MAP()
  95. };
  96. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  97. {
  98. //{{AFX_DATA_INIT(CAboutDlg)
  99. //}}AFX_DATA_INIT
  100. }
  101. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  102. {
  103. CDialog::DoDataExchange(pDX);
  104. //{{AFX_DATA_MAP(CAboutDlg)
  105. //}}AFX_DATA_MAP
  106. }
  107. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  108. //{{AFX_MSG_MAP(CAboutDlg)
  109. // No message handlers
  110. //}}AFX_MSG_MAP
  111. END_MESSAGE_MAP()
  112. // App command to run the dialog
  113. void CMFC_DEMOApp::OnAppAbout()
  114. {
  115. CAboutDlg aboutDlg;
  116. aboutDlg.DoModal();
  117. }
  118. /////////////////////////////////////////////////////////////////////////////
  119. // CMFC_DEMOApp commands