ReadSensor.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // ReadSensor.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "ReadSensor.h"
  5. #include "ReadSensorDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #endif
  9. // CReadSensorApp
  10. BEGIN_MESSAGE_MAP(CReadSensorApp, CWinApp)
  11. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  12. END_MESSAGE_MAP()
  13. // CReadSensorApp construction
  14. CReadSensorApp::CReadSensorApp()
  15. {
  16. // support Restart Manager
  17. m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
  18. // TODO: add construction code here,
  19. // Place all significant initialization in InitInstance
  20. }
  21. // The one and only CReadSensorApp object
  22. CReadSensorApp theApp;
  23. // CReadSensorApp initialization
  24. BOOL CReadSensorApp::InitInstance()
  25. {
  26. //TODO: call AfxInitRichEdit2() to initialize richedit2 library.
  27. // InitCommonControlsEx() is required on Windows XP if an application
  28. // manifest specifies use of ComCtl32.dll version 6 or later to enable
  29. // visual styles. Otherwise, any window creation will fail.
  30. INITCOMMONCONTROLSEX InitCtrls;
  31. InitCtrls.dwSize = sizeof(InitCtrls);
  32. // Set this to include all the common control classes you want to use
  33. // in your application.
  34. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  35. InitCommonControlsEx(&InitCtrls);
  36. AfxInitRichEdit();
  37. AfxInitRichEdit2();
  38. CWinApp::InitInstance();
  39. AfxEnableControlContainer();
  40. // Create the shell manager, in case the dialog contains
  41. // any shell tree view or shell list view controls.
  42. CShellManager *pShellManager = new CShellManager;
  43. // Activate "Windows Native" visual manager for enabling themes in MFC controls
  44. CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
  45. // Standard initialization
  46. // If you are not using these features and wish to reduce the size
  47. // of your final executable, you should remove from the following
  48. // the specific initialization routines you do not need
  49. // Change the registry key under which our settings are stored
  50. // TODO: You should modify this string to be something appropriate
  51. // such as the name of your company or organization
  52. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  53. CReadSensorDlg dlg;
  54. m_pMainWnd = &dlg;
  55. INT_PTR nResponse = dlg.DoModal();
  56. if (nResponse == IDOK)
  57. {
  58. // TODO: Place code here to handle when the dialog is
  59. // dismissed with OK
  60. }
  61. else if (nResponse == IDCANCEL)
  62. {
  63. // TODO: Place code here to handle when the dialog is
  64. // dismissed with Cancel
  65. }
  66. else if (nResponse == -1)
  67. {
  68. TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
  69. TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
  70. }
  71. // Delete the shell manager created above.
  72. if (pShellManager != NULL)
  73. {
  74. delete pShellManager;
  75. }
  76. // Since the dialog has been closed, return FALSE so that we exit the
  77. // application, rather than start the application's message pump.
  78. return FALSE;
  79. }