MFC-人为实现代码

MFC基于下面两个类去实现:

  1. 应用程序类CWinApp
  2. 框架类CWndFrame

建立一个要实现的MFC头文件,并包含头文件:

#include<afxwin.h>

创建两个分别基于CWinApp和CWinFrame类的派生类:

class CChildApp:public CWinApp
{
	public:
	virtual bool InitInatance();
}

class CChildFrame:public CWinFrame
{
	public:
	CChildFrame();
}

分别实现类中的方法:

	bool CChildApp::InitInatance()
	{
		CChildFrame* cChild = new CChildFrame;
		cChild->ShowWindow(SW_SHOW);
		cChild->UpdateWindow();
		return true;
	}

	CChildFrame::CChildFrame()
	{
		create(NULL,_T("MFC"));
	}

猜你喜欢

转载自blog.csdn.net/qq_37774304/article/details/86421304
今日推荐