OnPaint()
it is a function.
also, ON_WM_PAINT() expect 
afx_msg void OnPaint( CDC* pDC );

解决方案 »

  1.   

    看看你的MESSAGE_MAP有没有WM_PAINT的映射
      

  2.   

    在修改了若干书写错误以后仍然出现下面的问题:--------------------Configuration: SMFC1 - Win32 Debug--------------------
    Linking...
    libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/SMFC1.exe : fatal error LNK1120: 1 unresolved externals
    执行 link.exe 时出错.SMFC1.exe - 1 error(s), 0 warning(s)===================================================================================
    修改后的代码如下:#include <afxwin.h>class CMyWin:public CFrameWnd
    {
    public:
    CMyWin(){}
    protected:
    afx_msg void OnPaint();
    DECLARE_MESSAGE_MAP()
    };BEGIN_MESSAGE_MAP(CMyWin ,CFrameWnd )
    ON_WM_PAINT()
    END_MESSAGE_MAP()void CMyWin::OnPaint()
    {
    CString str = "Hello,MFC!";
    CRect rect(240 ,100 ,340 ,200);
    CPaintDC dc(this);
    dc.DrawText(str ,&rect ,DT_CENTER );
    }class CMyApp:public CWinApp
    {
    public :
    BOOL InitInstance();
    };BOOL CMyApp::InitInstance()
    {
    CMyWin *pFrame = new CMyWin;
    pFrame->Create(0 ,_T("使用MFC的Win32 Application"));
    pFrame->ShowWindow(1);
    pFrame->UpdateWindow();
    this->m_pMainWnd = pFrame;
    return TRUE;
    }CMyApp theApp;
      

  3.   

    project->setting
    在general里microsoft foundation class里选using MFC in share dll
    就可以了
      

  4.   


    单击Project Settings对话框的Link选项卡,全部删除/Subsystem:windows或console开关,VC++的Developer Studio 将自动创建WIN32应用或WIN32控制台。