xiaobin_hlj80

https://blog.csdn.net/xiaobin_HLJ80 http://blog.chinaunix.net/uid/31552151.html

导航

my first mfc application

  • 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

posted on 2026-09-16 23:00  xiaobin80  阅读(3)  评论(0)    收藏  举报