HSC.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // HSC.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "HSC.h"
  5. #include "HSCDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #endif
  9. // CHSCApp
  10. BEGIN_MESSAGE_MAP(CHSCApp, CWinApp)
  11. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  12. END_MESSAGE_MAP()
  13. // CHSCApp construction
  14. CHSCApp::CHSCApp()
  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 CHSCApp object
  22. CHSCApp theApp;
  23. // CHSCApp initialization
  24. BOOL CHSCApp::InitInstance()
  25. {
  26. // InitCommonControlsEx() is required on Windows XP if an application
  27. // manifest specifies use of ComCtl32.dll version 6 or later to enable
  28. // visual styles. Otherwise, any window creation will fail.
  29. INITCOMMONCONTROLSEX InitCtrls;
  30. InitCtrls.dwSize = sizeof(InitCtrls);
  31. // Set this to include all the common control classes you want to use
  32. // in your application.
  33. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  34. InitCommonControlsEx(&InitCtrls);
  35. CWinApp::InitInstance();
  36. AfxEnableControlContainer();
  37. // Create the shell manager, in case the dialog contains
  38. // any shell tree view or shell list view controls.
  39. CShellManager *pShellManager = new CShellManager;
  40. // Activate "Windows Native" visual manager for enabling themes in MFC controls
  41. CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
  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. // Change the registry key under which our settings are stored
  47. // TODO: You should modify this string to be something appropriate
  48. // such as the name of your company or organization
  49. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  50. CHSCDlg dlg;
  51. m_pMainWnd = &dlg;
  52. INT_PTR nResponse = dlg.DoModal();
  53. if (nResponse == IDOK)
  54. {
  55. // TODO: Place code here to handle when the dialog is
  56. // dismissed with OK
  57. }
  58. else if (nResponse == IDCANCEL)
  59. {
  60. // TODO: Place code here to handle when the dialog is
  61. // dismissed with Cancel
  62. }
  63. else if (nResponse == -1)
  64. {
  65. TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
  66. TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
  67. }
  68. // Delete the shell manager created above.
  69. if (pShellManager != NULL)
  70. {
  71. delete pShellManager;
  72. }
  73. // Since the dialog has been closed, return FALSE so that we exit the
  74. // application, rather than start the application's message pump.
  75. return FALSE;
  76. }