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

推荐订阅源

Google DeepMind News
Google DeepMind News
L
LangChain Blog
H
Help Net Security
博客园_首页
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
Recent Announcements
Recent Announcements
D
DataBreaches.Net
U
Unit 42
Vercel News
Vercel News
I
InfoQ
Martin Fowler
Martin Fowler
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
Jina AI
Jina AI
博客园 - 叶小钗
博客园 - 【当耐特】
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
Last Week in AI
Last Week in AI

博客园 - xiaobin80

Hello MFC - The Message Map my first mfc application 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
Hello MFC - Add Resource and About Dialog
xiaobin80 · 2026-09-18 · via 博客园 - xiaobin80

Add Resource

add_res-hellomfc

dialog bar

add_res2-hellomfc

property:

  • Style: Popup
  • System Menu: True
  • Title Bar: True

Set Icon

  • add picture
    add_res3-hellomfc

add_res4-hellomfc

  • picture control

type: Icon
Image: IDI_ICON1

add_res5-hellomfc

About Dialog

  • add class
    add_class1-hellomfc

  • add resource head file

#include "resource.h"

project

solution-hellomfc

Add Button

  • Declare
private:
    CButton m_btnAbout;
  • impl
    CRect rt;
    rt.top = 10;
    rt.left = 150;
    rt.right = 250;
    rt.bottom = 30;

    m_btnAbout.Create(_T("About"),
        WS_CHILD | WS_VISIBLE,
        rt,
        this,
        ID_ABOUT); // #define ID_ABOUT 1101

Button Event

  • Declare
public:
    afx_msg void OnBtnClick();
  • impl
afx_msg void CMainWindow::OnBtnClick()
{
    CAboutDlg dlgAbout;  // #include "AboutDlg.h"
    dlgAbout.DoModal();
}

Add Message Map

  • Declare
DECLARE_MESSAGE_MAP()
  • impl
BEGIN_MESSAGE_MAP(CMainWindow, CFrameWnd)
    ON_COMMAND(ID_ABOUT, OnBtnClick)
END_MESSAGE_MAP()