MenuXPApp.cpp
上传用户:lejushen
上传日期:2007-01-10
资源大小:183k
文件大小:4k
源码类别:

菜单

开发平台:

Visual C++

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