xiaobin_hlj80

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

导航

第一个MFC程序

  • Windwos 10 1809(LTSC)
  • Visual Studio 2013

project wizard

Create an empty Win32 project.

new_project1-win32
click Empty Project
new_project2-win32

Generate using the class wizard

  • CMainWindow
    add_class1-win32
  • CMyApp
    add_class2-win32

Note:
You need to include "<afxwin.h>" in all header files.

add window caption - MainWindow

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;
}

done

Add it to MyApp.cpp

CMyApp myApp;

Use MFC In a Static Library

mfc_static_lib-Win32

Ref

posted on 2025-11-04 20:20  xiaobin80  阅读(13)  评论(0)    收藏  举报