using CFrameWnd and CWinApp.
2025-11-15
Written by: xiaobin
Create an empty Win32 project.

Windows Desktop Wizard

d: VS2022 is the fourth version of v14. 14(17.14): 14 is the last minor version of VS2022.

Note:
You need to include “afxwin.h” in all header files.
Add constructor
public:
CMainWindow();
CMainWindow::CMainWindow()
{
Create(NULL, _T("Hello MFC"));
}
public:
virtual BOOL InitInstance();
BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMainWindow();
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
#include "CMainWindow.h"
Add it to MyApp.cpp
CMyApp myApp;
error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version.
Please #define _AFXDLL or do not use /MD[d]

