Advertisement
Guest User

Untitled

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