MyApp.h: class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
// frame window class
class CMyFrame : public CFrameWnd
{
public:
CMyFrame();
protected:
// "afx_msg" indicates that the function is part
// of the MFC library message dispatch system
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
MyApp.cpp:
#include // MFC library header file declares base classes
#include "myapp.h"
CMyApp theApp; // the one and only CMyApp object
BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMyFrame, CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CMyFrame::CMyFrame()
{
Create(NULL, "MYAPP Application");
}
void CMyFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0, 0, "Hello, MFC!");
}