惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

博客园 - xiaobin80

Development Environment Preparation Clang IDE的选择在Windows Visual Studio 2017 and Fx EOL 跟我学python(5)- 匹配数字 跟我学python(4)- 正则 跟我学python(3)--- 带shell功能的hello world 跟我学python(2)- 第一个程序 跟我学python --- 搭建开发平台 Debian server 安装 debian 与 ubuntu 之 - sudo Try Value 计算文件CRC32数值 docker ce on Debian 使用hugo在gitee上写blog spring cloud gateway - RequestRateLimiter postman使用 改进的冒泡算法 Create User - mysql COM调用 – VB、PB J-Link clone问题 修复山寨版的J-Link
my first mfc application
xiaobin80 · 2026-09-16 · via 博客园 - xiaobin80
  • project wizard
  • class wizard
  • add window title
  • Instantiation

project wizard

Create an empty Win32 project.
new_project1-win32
new_project2-win32

VS2022

Windows Desktop Wizard
new_project2d14-win32
d: VS2022 is the fourth version of v14.
14(17.14): 14 is the last minor version of VS2022.

Generate using the class wizard

add_class1-win32
add_class2-win32
Note:
You need to include "afxwin.h" in all header files.

add window caption - MainWindow

Add constructor

  • declare
public:
    CMainWindow();
  • impl
CMainWindow::CMainWindow()
{
    Create(NULL, _T("Hello MFC"));
}

add initial instance - MyApp

  • declare
public:
    virtual BOOL InitInstance();
  • impl
BOOL CMyApp::InitInstance()
{
    m_pMainWnd = new CMainWindow();
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    return TRUE;
}

include head file

#include "CMainWindow.h"

done

Add it to MyApp.cpp

CMyApp myApp;

compile

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]

mfc_static_lib-Win32

  • VC6
    mfc_static_lib1vc6-win32