从这一篇开始,详细记录一下MFC的源码解读

四个文件,分别为:

stdafx.h,stdafx.cpp,hello.h,hello.cpp

代码如下:

//stdafx.h
#include <afxwin.h>
//stdafx.cpp
#include "stdafx.h"
//hello.h
class CMyWinApp:public CWinApp
{
public:
BOOL InitInstance();
};
class CMyFrameWnd:public CFrameWnd
{
public:
    CMyFrameWnd();
};
//hello.cpp
#include "stdafx.h"
#include "hello.h"

CMyWinApp theApp;

BOOL CMyWinApp::InitInstance()
{
    m_pMainWnd=new CMyFrameWnd();
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();
    return TRUE;
}
CMyFrameWnd::CMyFrameWnd()
{
    Create(NULL,"Hello MFC",WS_OVERLAPPEDWINDOW|WS_VSCROLL,CRect(40,60,900,300),NULL,"MainMenu");
}

 

相关文章:

  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-05-31
  • 2021-07-07
  • 2021-11-16
  • 2022-12-23
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2021-12-13
  • 2021-12-16
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案