| 38 | // CAPIExampleApp initialization |
| 39 | |
| 40 | BOOL CAPIExampleApp::InitInstance() |
| 41 | { |
| 42 | // InitCommonControlsEx() is required on Windows XP if an application |
| 43 | // manifest specifies use of ComCtl32.dll version 6 or later to enable |
| 44 | // visual styles. Otherwise, any window creation will fail. |
| 45 | INITCOMMONCONTROLSEX InitCtrls; |
| 46 | InitCtrls.dwSize = sizeof(InitCtrls); |
| 47 | // Set this to include all the common control classes you want to use |
| 48 | // in your application. |
| 49 | InitCtrls.dwICC = ICC_WIN95_CLASSES; |
| 50 | InitCommonControlsEx(&InitCtrls); |
| 51 | |
| 52 | CWinApp::InitInstance(); |
| 53 | |
| 54 | AfxEnableControlContainer(); |
| 55 | InitKeyInfomation(); |
| 56 | // Create the shell manager, in case the dialog contains |
| 57 | // any shell tree view or shell list view controls. |
| 58 | CShellManager *pShellManager = new CShellManager; |
| 59 | |
| 60 | // Activate "Windows Native" visual manager for enabling themes in MFC controls |
| 61 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); |
| 62 | |
| 63 | // Standard initialization |
| 64 | // If you are not using these features and wish to reduce the size |
| 65 | // of your final executable, you should remove from the following |
| 66 | // the specific initialization routines you do not need |
| 67 | // Change the registry key under which our settings are stored |
| 68 | // TODO: You should modify this string to be something appropriate |
| 69 | // such as the name of your company or organization |
| 70 | SetRegistryKey(_T("Local AppWizard-Generated Applications")); |
| 71 | |
| 72 | CAPIExampleDlg dlg; |
| 73 | m_pMainWnd = &dlg; |
| 74 | INT_PTR nResponse = dlg.DoModal(); |
| 75 | if (nResponse == IDOK) |
| 76 | { |
| 77 | // TODO: Place code here to handle when the dialog is |
| 78 | // dismissed with OK |
| 79 | } |
| 80 | else if (nResponse == IDCANCEL) |
| 81 | { |
| 82 | // TODO: Place code here to handle when the dialog is |
| 83 | // dismissed with Cancel |
| 84 | } |
| 85 | else if (nResponse == -1) |
| 86 | { |
| 87 | TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n"); |
| 88 | TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); |
| 89 | } |
| 90 | |
| 91 | // Delete the shell manager created above. |
| 92 | if (pShellManager != nullptr) |
| 93 | { |
| 94 | delete pShellManager; |
| 95 | } |
| 96 | |
| 97 | #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS) |
nothing calls this directly
no test coverage detected