The problem has been solved, and today it is a bit crazy.
The reason is as follows:
If you want to modify the existing project, you need to use the comparison tool to integrate the following code. The solution is as follows:
1. Add the following content to the initialization function initinstance () of the cxxxapp class, such as cmfcapplication1app.
Write the following before cwinappex: initinstance:
// If an Application List running on Windows XP specifies that you want to use comctl32.dll version 6 or later to enable visualization, // you need initcommoncontrolsex (). Otherwise, a window cannot be created. Initcommoncontrolsex initctrls; initctrls. dwsize = sizeof (initctrls); // set it to include all the // public control classes to be used in the application. Initctrls. dwicc = icc_win95_classes; initcommoncontrolsex (& initctrls );
Then in:
CWinAppEx::InitInstance();// Initialize OLE librariesif (!AfxOleInit()){AfxMessageBox(IDP_OLE_INIT_FAILED);return FALSE;}
Then, add the following sentence:
AfxEnableControlContainer();
2. Modify the header file: stdafx. H. Add this section:
# Include <afxdisp. h> // MFC automation class
#ifdef _UNICODE#if defined _M_IX86#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")#elif defined _M_X64#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")#else#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")#endif#endif
Get it done!
The problem is described as follows:
Windows 7:
Windows classic: