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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
A
About on SuperTechFans
腾讯CDC
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
I
InfoQ
博客园 - 【当耐特】
美团技术团队
GbyAI
GbyAI
量子位
宝玉的分享
宝玉的分享
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - Franky
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志

博客园 - xiaobin80

Hello MFC - The Message Map 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