- Select template of Visual C++ Win32 Project, with name of MFCminApplication, and click OK.

- Click Next on the Application Settings screen.

- Check Empty project option, and click Finish.

- After project created, click Project on the top menu, and select the project properties - MFCminApplication Properties...

- Select Configuration Properties -> General tab, select Use MFC in Shared DLL in Use of MFC property.

- Right click Source Files in Solution Explorer, -> Add -> Class to craete a new source file.

- Select Visual C++ Class, and click Add.

- Enter Class name of CMFCminApplication(both .h and .cpp file name will be generatedautomatically), with Base class of CWinApp, public Access. Finish.

- You will be complained Bass class 'CWinApp' not found in the project. Click Yes to continue adding the class.

- Modify the generated MFCminApplication.h and MFCminApplication.cpp:
MFCminApplication.h
#pragma once
#include <afxwin.h>
class CMFCminApplication :
public CWinApp
{
public:
virtual BOOL InitInstance();
};
MFCminApplication.cpp
#include "MFCminApplication.h"
class CMFCminFrameWnd :
public CFrameWnd
{
public:
CMFCminFrameWnd(){
Create(0, L"Hello, Minimal MFC Application");
}
};
BOOL CMFCminApplication::InitInstance(){
m_pMainWnd = new CMFCminFrameWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
return TRUE;
}
CMFCminApplication myApplication;
- Finally, you can build and run the application.

- The minimal application change the title only!

No comments:
Post a Comment