It replaces the entry-point with the "unmanaged" entry in CWinApp, which correctly initialize the CRT/MFC/ATL.
1. Change the "entry point" in you linker settings from "main" to "wWinMainCRTStartup" 2. Add "#include <afxwin.h>" to your "stdafx.h" 3. Replace your "main" method with the following: class CMFCApp : public CWinApp { public: virtual BOOL InitInstance() { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew Form1()); return FALSE; } } theApp;
|
| 本文出自 51CTO.COM技术博客 |