VS2010用Win32创建MFC窗口程序编译错误,窗口闪退
来源:http://blog.csdn.net/misskissc/article/details/8631532
1、MFCWinCret.h
#include "stdafx.h"
#include <afxwin.h>
class GameApp:public CWinApp
{
public:
public:
GameApp();
~GameApp();
virtual BOOL InitInstance();
};
class GameWnd:public CFrameWnd
{
public:
GameWnd();
~GameWnd();
private:
DECLARE_MESSAGE_MAP();
};
#include "stdafx.h"
#include "MFCWinCret.h"
#include <afxwin.h>
#include "resource.h"
GameApp MyApp;
BOOL GameApp::InitInstance()
{
m_pMainWnd=new GameWnd();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
GameWnd::GameWnd()
{
CString strmyclass;
strmyclass="hi";
Create(NULL,strmyclass,WS_CAPTION|WS_THICKFRAME|WS_MINIMIZEBOX,CRect(40,50,500,500),NULL,NULL);
}
GameApp::GameApp()
{
}
GameApp::~GameApp()
{
delete m_pMainWnd;
}
GameWnd::~GameWnd()
{
}
BEGIN_MESSAGE_MAP(GameWnd,CFrameWnd)
END_MESSAGE_MAP()
#include "targetver.h"
#include <afxwin.h>
#include "stdafx.h"
#pragma once
#include <sdkddkver.h>
Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
HEAP[game.exe]: Invalid address specified to RtlValidateHeap( 00A30000, 01788BE8 )