WaveEdit.cpp
上传用户:samlee1007
上传日期:2007-01-02
资源大小:123k
文件大小:4k
源码类别:

文件操作

开发平台:

Visual C++

  1. // WaveEdit.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "WaveEdit.h"
  5. #include "MainFrm.h"
  6. #include "WaveEditDoc.h"
  7. #include "WaveEditView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CWaveEditApp
  15. BEGIN_MESSAGE_MAP(CWaveEditApp, CWinApp)
  16. //{{AFX_MSG_MAP(CWaveEditApp)
  17. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  18. //}}AFX_MSG_MAP
  19. // Standard file based document commands
  20. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  21. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  22. END_MESSAGE_MAP()
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CWaveEditApp construction
  25. CWaveEditApp::CWaveEditApp()
  26. {
  27. }
  28. /////////////////////////////////////////////////////////////////////////////
  29. // The one and only CWaveEditApp object
  30. CWaveEditApp theApp;
  31. static const CLSID clsid =
  32. { 0x618031a5, 0x6a68, 0x11d2, { 0xb4, 0xad, 0xde, 0xc1, 0xca, 0xfe, 0x5b, 0x54 } };
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CWaveEditApp initialization
  35. BOOL CWaveEditApp::InitInstance()
  36. {
  37. // Initialize OLE libraries
  38. if (!AfxOleInit())
  39. {
  40. AfxMessageBox(IDP_OLE_INIT_FAILED);
  41. return FALSE;
  42. }
  43. // Standard initialization
  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. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  51. LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  52. // Register document templates
  53. CSingleDocTemplate* pDocTemplate;
  54. pDocTemplate = new CSingleDocTemplate(
  55. IDR_MAINFRAME,
  56. RUNTIME_CLASS(CWaveEditDoc),
  57. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  58. RUNTIME_CLASS(CWaveEditView));
  59. AddDocTemplate(pDocTemplate);
  60. m_server.ConnectTemplate(clsid, pDocTemplate, TRUE);
  61. // Parse command line for standard shell commands, DDE, file open
  62. CCommandLineInfo cmdInfo;
  63. ParseCommandLine(cmdInfo);
  64. if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
  65. {
  66. COleTemplateServer::RegisterAll();
  67. // Application was run with /Embedding or /Automation.  Don't show the
  68. //  main window in this case.
  69. return TRUE;
  70. }
  71. m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
  72. COleObjectFactory::UpdateRegistryAll();
  73. // Dispatch commands specified on the command line
  74. if (!ProcessShellCommand(cmdInfo))
  75. return FALSE;
  76. m_pMainWnd->ShowWindow(SW_SHOW);
  77. m_pMainWnd->UpdateWindow();
  78. return TRUE;
  79. }
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CAboutDlg dialog used for App About
  82. class CAboutDlg : public CDialog
  83. {
  84. public:
  85. CAboutDlg();
  86. // Dialog Data
  87. //{{AFX_DATA(CAboutDlg)
  88. enum { IDD = IDD_ABOUTBOX };
  89. //}}AFX_DATA
  90. // ClassWizard generated virtual function overrides
  91. //{{AFX_VIRTUAL(CAboutDlg)
  92. protected:
  93. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  94. //}}AFX_VIRTUAL
  95. // Implementation
  96. protected:
  97. //{{AFX_MSG(CAboutDlg)
  98. // No message handlers
  99. //}}AFX_MSG
  100. DECLARE_MESSAGE_MAP()
  101. };
  102. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  103. {
  104. //{{AFX_DATA_INIT(CAboutDlg)
  105. //}}AFX_DATA_INIT
  106. }
  107. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  108. {
  109. CDialog::DoDataExchange(pDX);
  110. //{{AFX_DATA_MAP(CAboutDlg)
  111. //}}AFX_DATA_MAP
  112. }
  113. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  114. //{{AFX_MSG_MAP(CAboutDlg)
  115. // No message handlers
  116. //}}AFX_MSG_MAP
  117. END_MESSAGE_MAP()
  118. // App command to run the dialog
  119. void CWaveEditApp::OnAppAbout()
  120. {
  121. CAboutDlg aboutDlg;
  122. aboutDlg.DoModal();
  123. }
  124. /////////////////////////////////////////////////////////////////////////////
  125. // CWaveEditApp commands
  126. void CWaveEditApp::ShowApp(int nShow)
  127. {
  128. m_pMainWnd->ShowWindow(nShow);
  129. }