class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
        afx_msg void OnPaint ();
        afx_msg int OnCreate(LPCREATESTRUCT);
        afx_msg void OnLButtonDown(UINT,CPoint);
afx_msg void OnLButtonUp(UINT,CPoint);
        afx_msg void OnRButtonDown(UINT,CPoint);
afx_msg void OnColor(UINT);    DECLARE_MESSAGE_MAP ()};ON_COMMAND(ID_RED, *CMainWindow::OnColor(UINT))
ON_COMMAND(ID_GREEN,*CMainWindow::OnColor(UINT))
====================================================================
1>------ 已启动生成: 项目: mfc, 配置: Debug Win32 ------
1>正在编译...
1>1.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\users\administrator\desktop\win32\1\1\1.cpp(49) : error C2275: “UINT”: 将此类型用作表达式非法
1>        c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(173) : 参见“UINT”的声明
1>c:\users\administrator\desktop\win32\1\1\1.cpp(50) : error C2275: “UINT”: 将此类型用作表达式非法
1>        c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(173) : 参见“UINT”的声明
1>生成日志保存在“file://c:\Users\Administrator\Desktop\WIN32\1\1\Debug\BuildLog.htm”
1>mfc - 2 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

解决方案 »

  1.   

    BEGIN_MESSAGE_MAP(CMFCTestDlg, CDialog)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    //}}AFX_MSG_MAP
    ON_BN_CLICKED(IDC_BUTTON1, &CMFCTestDlg::OnBnClickedButton1)
    END_MESSAGE_MAP()afx_msg void OnBnClickedButton1();void CMFCTestDlg::OnBnClickedButton1()
    {
    // TODO: Add your control notification handler code here
    }
      

  2.   

    ON_COMMAND(ID_RED, *CMainWindow::OnColor(UINT))
    ===========
    这个后面是不能加参数的,改成这样:
    ON_COMMAND(ID_RED, *CMainWindow::OnColor)