Source code of Windows XP (NT5)
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.

161 lines
4.2 KiB

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