MFC Processing Messages Example

#include <afxwin.h>
class CSimpleApp : public CWinApp
{
public:
BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
DECLARE_MESSAGE_MAP()
afx_msg void OnPaint();
};
BOOL CSimpleApp::InitInstance(){
m_pMainWnd = new CMainFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);
return TRUE;
}
CMainFrame::CMainFrame()
{
Create(NULL, TEXT("MFC processing messages"));
}
BEGIN_MESSAGE_MAP(CMainFrame,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CSimpleApp MFCApp1;
afx_msg void CMainFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0,0,TEXT("hello world"));
}