HDraw.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // HDraw.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "HDraw.h"
  5. #include "MainFrm.h"
  6. #include "HDrawDoc.h"
  7. #include "HDrawPView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CHDrawApp
  15. BEGIN_MESSAGE_MAP(CHDrawApp, CWinApp)
  16. //{{AFX_MSG_MAP(CHDrawApp)
  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. // CHDrawApp construction
  29. CHDrawApp::CHDrawApp()
  30. {
  31. // TODO: add construction code here,
  32. // Place all significant initialization in InitInstance
  33. }
  34. /////////////////////////////////////////////////////////////////////////////
  35. // The one and only CHDrawApp object
  36. CHDrawApp theApp;
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CHDrawApp initialization
  39. BOOL CHDrawApp::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(CHDrawDoc),
  62. RUNTIME_CLASS(CMainFrame), // main SDI frame window
  63. RUNTIME_CLASS(CHDrawPView));
  64. AddDocTemplate(pDocTemplate);
  65. // Enable DDE Execute open
  66. EnableShellOpen();
  67. RegisterShellFileTypes(TRUE);
  68. // Parse command line for standard shell commands, DDE, file open
  69. CCommandLineInfo cmdInfo;
  70. ParseCommandLine(cmdInfo);
  71. // Dispatch commands specified on the command line
  72. if (!ProcessShellCommand(cmdInfo))
  73. return FALSE;
  74. // The one and only window has been initialized, so show and update it.
  75. m_pMainWnd->ShowWindow(SW_SHOW);
  76. m_pMainWnd->UpdateWindow();
  77. // Enable drag/drop open
  78. m_pMainWnd->DragAcceptFiles();
  79. return TRUE;
  80. }
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CAboutDlg dialog used for App About
  83. class CAboutDlg : public CDialog
  84. {
  85. public:
  86. CAboutDlg();
  87. // Dialog Data
  88. //{{AFX_DATA(CAboutDlg)
  89. enum { IDD = IDD_ABOUTBOX };
  90. //}}AFX_DATA
  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. // Implementation
  97. protected:
  98. //{{AFX_MSG(CAboutDlg)
  99. // No message handlers
  100. //}}AFX_MSG
  101. DECLARE_MESSAGE_MAP()
  102. };
  103. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  104. {
  105. //{{AFX_DATA_INIT(CAboutDlg)
  106. //}}AFX_DATA_INIT
  107. }
  108. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  109. {
  110. CDialog::DoDataExchange(pDX);
  111. //{{AFX_DATA_MAP(CAboutDlg)
  112. //}}AFX_DATA_MAP
  113. }
  114. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  115. //{{AFX_MSG_MAP(CAboutDlg)
  116. // No message handlers
  117. //}}AFX_MSG_MAP
  118. END_MESSAGE_MAP()
  119. // App command to run the dialog
  120. void CHDrawApp::OnAppAbout()
  121. {
  122. CAboutDlg aboutDlg;
  123. aboutDlg.DoModal();
  124. }
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CHDrawApp message handlers