hello.cpp

来自「此程序为mfc的入门程序 hello world」· C++ 代码 · 共 39 行

CPP
39
字号
#include <afxwin.h>
#include "Hello.h"
#define _AFXDLL 
CMyApp myApp;

/////////////////////////////////////////////////////////////////////////
// CMyApp member functions

BOOL CMyApp::InitInstance ()
{
	m_pMainWnd = new CMainWindow;
	m_pMainWnd->ShowWindow (m_nCmdShow);
	m_pMainWnd->UpdateWindow ();
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions

BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
	ON_WM_PAINT ()
END_MESSAGE_MAP ()

CMainWindow::CMainWindow ()
{
	Create (NULL, _T ("The Hello Application"));
}

void CMainWindow::OnPaint ()
{
	CPaintDC dc (this);

	CRect rect;
	GetClientRect (&rect);

	dc.DrawText (_T ("Hello, MFC"), -1, &rect,
		DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?