#include <afxwin.h>
class CHelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
protected:
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint cpoint);
DECLARE_MESSAGE_MAP()
};
BOOL CHelloApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(m_nCmdShow);
return TRUE;
}
CMainFrame::CMainFrame()
{
Create(NULL, _T("HelloMFC"));
}
void CMainFrame::OnPaint()
{
CPaintDC dc(this);
TCHAR * msg = _T("Hello,MFC");
dc.TextOut(100, 100, msg, lstrlen(msg));
}
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint cpoint)
{
MessageBox(_T("마우스 클릭!"), _T("마우스 메시지"));
}
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
원문 코드이고
저 부분에서 계속 엔티티 초기화를 할 수 없다는데 어떻게 해결해야되죠;
심지어 책보고 따라한 코드인데 이렇게 나오네요.
댓글 0