QZoomViewDemo.cpp
上传用户:xp9161
上传日期:2009-12-21
资源大小:70k
文件大小:3k
源码类别:

Windows编程

开发平台:

Visual C++

  1. // QZoomViewDemo.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "QZoomViewDemo.h"
  5. #include "MainFrm.h"
  6. #include "QZVDemoDoc.h"
  7. #include "QZVDemoView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #endif
  11. // CQZVDemoApp
  12. BEGIN_MESSAGE_MAP(CQZVDemoApp, CWinApp)
  13. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  14. // Standard file based document commands
  15. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  16. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  17. // Standard print setup command
  18. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  19. END_MESSAGE_MAP()
  20. // CQZVDemoApp construction
  21. CQZVDemoApp::CQZVDemoApp()
  22. {
  23. // TODO: add construction code here,
  24. // Place all significant initialization in InitInstance
  25. }
  26. // The one and only CQZVDemoApp object
  27. CQZVDemoApp theApp;
  28. // CQZVDemoApp initialization
  29. BOOL CQZVDemoApp::InitInstance()
  30. {
  31. // InitCommonControls() is required on Windows XP if an application
  32. // manifest specifies use of ComCtl32.dll version 6 or later to enable
  33. // visual styles.  Otherwise, any window creation will fail.
  34. InitCommonControls();
  35. CWinApp::InitInstance();
  36. // Standard initialization
  37. // If you are not using these features and wish to reduce the size
  38. // of your final executable, you should remove from the following
  39. // the specific initialization routines you do not need
  40. // Change the registry key under which our settings are stored
  41. // TODO: You should modify this string to be something appropriate
  42. // such as the name of your company or organization
  43. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  44. LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
  45. // Register the application's document templates.  Document templates
  46. //  serve as the connection between documents, frame windows and views
  47. CSingleDocTemplate* pDocTemplate;
  48. pDocTemplate = new CSingleDocTemplate(
  49. IDR_MAINFRAME,
  50. RUNTIME_CLASS(CQZVDemoDoc),
  51. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  52. RUNTIME_CLASS(CQZVDemoView));
  53. AddDocTemplate(pDocTemplate);
  54. // Parse command line for standard shell commands, DDE, file open
  55. CCommandLineInfo cmdInfo;
  56. ParseCommandLine(cmdInfo);
  57. // Dispatch commands specified on the command line.  Will return FALSE if
  58. // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
  59. if (!ProcessShellCommand(cmdInfo))
  60. return FALSE;
  61. // The one and only window has been initialized, so show and update it
  62. m_pMainWnd->ShowWindow(SW_SHOW);
  63. m_pMainWnd->UpdateWindow();
  64. // call DragAcceptFiles only if there's a suffix
  65. //  In an SDI app, this should occur after ProcessShellCommand
  66. return TRUE;
  67. }
  68. // CAboutDlg dialog used for App About
  69. class CAboutDlg : public CDialog
  70. {
  71. public:
  72. CAboutDlg();
  73. // Dialog Data
  74. enum { IDD = IDD_ABOUTBOX };
  75. protected:
  76. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  77. // Implementation
  78. protected:
  79. DECLARE_MESSAGE_MAP()
  80. };
  81. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  82. {
  83. }
  84. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  85. {
  86. CDialog::DoDataExchange(pDX);
  87. }
  88. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  89. END_MESSAGE_MAP()
  90. // App command to run the dialog
  91. void CQZVDemoApp::OnAppAbout()
  92. {
  93. CAboutDlg aboutDlg;
  94. aboutDlg.DoModal();
  95. }
  96. // CQZVDemoApp message handlers