RealtimeSpeechRecognition.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // RealtimeSpeechRecognition.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "pch.h"
  4. #include "framework.h"
  5. #include "RealtimeSpeechRecognition.h"
  6. #include "RealtimeSpeechRecognitionDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #endif
  10. // CRealtimeSpeechRecognitionApp
  11. BEGIN_MESSAGE_MAP(CRealtimeSpeechRecognitionApp, CWinApp)
  12. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  13. END_MESSAGE_MAP()
  14. // CRealtimeSpeechRecognitionApp construction
  15. CRealtimeSpeechRecognitionApp::CRealtimeSpeechRecognitionApp()
  16. {
  17. // TODO: add construction code here,
  18. // Place all significant initialization in InitInstance
  19. }
  20. // The one and only CRealtimeSpeechRecognitionApp object
  21. CRealtimeSpeechRecognitionApp theApp;
  22. // CRealtimeSpeechRecognitionApp initialization
  23. BOOL CRealtimeSpeechRecognitionApp::InitInstance()
  24. {
  25. CWinApp::InitInstance();
  26. // Create the shell manager, in case the dialog contains
  27. // any shell tree view or shell list view controls.
  28. CShellManager *pShellManager = new CShellManager;
  29. // Activate "Windows Native" visual manager for enabling themes in MFC controls
  30. CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
  31. // Standard initialization
  32. // If you are not using these features and wish to reduce the size
  33. // of your final executable, you should remove from the following
  34. // the specific initialization routines you do not need
  35. // Change the registry key under which our settings are stored
  36. // TODO: You should modify this string to be something appropriate
  37. // such as the name of your company or organization
  38. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  39. CRealtimeSpeechRecognitionDlg dlg;
  40. m_pMainWnd = &dlg;
  41. INT_PTR nResponse = dlg.DoModal();
  42. if (nResponse == IDOK)
  43. {
  44. // TODO: Place code here to handle when the dialog is
  45. // dismissed with OK
  46. }
  47. else if (nResponse == IDCANCEL)
  48. {
  49. // TODO: Place code here to handle when the dialog is
  50. // dismissed with Cancel
  51. }
  52. else if (nResponse == -1)
  53. {
  54. TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
  55. TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
  56. }
  57. // Delete the shell manager created above.
  58. if (pShellManager != nullptr)
  59. {
  60. delete pShellManager;
  61. }
  62. #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
  63. ControlBarCleanUp();
  64. #endif
  65. // Since the dialog has been closed, return FALSE so that we exit the
  66. // application, rather than start the application's message pump.
  67. return FALSE;
  68. }