注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 raymond关于番茄花园事件..
 帮助

winform使用mfc产生异常的解决方案


2007-10-08 21:21:18
 标签:方案 mfc winform   [推送到技术圈]

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;

 




    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: