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

推荐订阅源

Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
L
LangChain Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
美团技术团队
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
D
DataBreaches.Net
P
Proofpoint News Feed
小众软件
小众软件
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
雷峰网
雷峰网
G
Google Developers Blog

博客园 - 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()