初学VC者的提问
chxr 2002-05-15 05:00:45 刚找书上抄的一个例子,工程是“32 application"
header:
class CFirstApp:public CWinApp
{
public:
virtual bool InitInstance();
};
class CFirstFrame:public CFrameWnd
{
public:
CFirstFrame();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP();
};
cpp:
# include "afxwin.h"
# include "first.h"
CFirstApp near theAPP;
bool CFirstApp::InitInstance()
{
m_pMainWnd=new CFirstFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
BEGIN_MESSAGE_MAP(CFirstFrame,CFrameWnd)
ON_WM_PAINT()
END_MSSAGE_MAP()
CFirstFrame::CFirstFrame()
{
Create(NULL,"First App");
}
void CFirstFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0,0,"Hello,world!");
}
怎么不行啊,麻烦大家看看,谢谢了。