在我的工程中,当我在ClassWizard中选中类,CGenWorkareaDlg时便出现如下提示:
A duplicate insert block exists for class "CGenWorkareaDlg" in the source files(E:\wzg\vc\bxs\GenWorkareaDlg.h,E:\wzg\vc\bxs\GenWorkareaDlg.cpp),并且不能选中CGenWorkareaDlg。请问这是为什么? 

解决方案 »

  1.   

    你的GenWorkareaDlg.h和GenWorkareaDlg贴出来看看
      

  2.   


    让wizard
    重新扫描一下
      

  3.   

    关闭工程,删除.aps,.ncb,.clw,打开工程,按Ctrl+W,然后一直点“确定”
      

  4.   

    清了工程,但没用。文件:GenWorkareaDlg.h
    #if !defined(AFX_GENWORKAREADLG_H__6373A330_95F6_44E8_8621_CA155D90491D__INCLUDED_)
    #define AFX_GENWORKAREADLG_H__6373A330_95F6_44E8_8621_CA155D90491D__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // GenWorkareaDlg.h : header file
    //
    #include "SortListCtrl.h"
    #include "WBButton.h" //加入位图按钮类/////////////////////////////////////////////////////////////////////////////
    // CGenWorkareaDlg dialogclass CGenWorkareaDlg : public CDialog
    {
    // Construction
    public:
    CGenWorkareaDlg(LPCTSTR lpszTemplateName, CWnd* pParent = NULL);
    CGenWorkareaDlg(UINT nIDTemplate, CWnd* pParent = NULL);   // standard constructor// Dialog Data
    CBrush m_Brush; //{{AFX_DATA(CGenWorkareaDlg)
    // enum { IDD = IDD_GENWORKAREADLG };
    // NOTE: the ClassWizard will add data members here
    //}}AFX_DATA
    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CGenWorkareaDlg)
    public:
    virtual BOOL PreTranslateMessage(MSG* pMsg);
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    virtual void OnOK( );
    //}}AFX_VIRTUAL// Implementation
    protected: // Generated message map functions
    //{{AFX_MSG(CGenWorkareaDlg)
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };//{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_GENWORKAREADLG_H__6373A330_95F6_44E8_8621_CA155D90491D__INCLUDED_)
    文件GenWorkareaDlg.cpp:
    // GenWorkareaDlg.cpp : implementation file
    //#include "stdafx.h"
    #include "bxs.h"
    #include "GenWorkareaDlg.h"
    #include "ChildView.h"
    #include "MainFrm.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CGenWorkareaDlg dialog
    CGenWorkareaDlg::CGenWorkareaDlg(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
    : CDialog(nIDTemplate, pParent)
    {
    //{{AFX_DATA_INIT(CGenWorkareaDlg)
    // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    m_Brush.CreateSolidBrush( WORKAREA_COLOR );
    }CGenWorkareaDlg::CGenWorkareaDlg(LPCTSTR lpszTemplateName, CWnd* pParent /*=NULL*/)
    : CDialog(lpszTemplateName, pParent)
    {
    //{{AFX_DATA_INIT(CGenWorkareaDlg)
    // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    m_Brush.CreateSolidBrush( WORKAREA_COLOR );
    }
    void CGenWorkareaDlg::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CGenWorkareaDlg)
    // NOTE: the ClassWizard will add DDX and DDV calls here
    //}}AFX_DATA_MAP
    }
    BEGIN_MESSAGE_MAP(CGenWorkareaDlg, CDialog)
    //{{AFX_MSG_MAP(CGenWorkareaDlg)
    ON_WM_CTLCOLOR()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CGenWorkareaDlg message handlersHBRUSH CGenWorkareaDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    pDC->SetBkMode(TRANSPARENT);

    if( nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_STATIC )
    {
    return m_Brush;
    } return hbr;
    }void CGenWorkareaDlg::OnOK()
    {
    }
    BOOL CGenWorkareaDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if (pMsg->message == WM_KEYDOWN)
        { 
            if(pMsg->wParam==VK_ESCAPE)
    {
    //MessageBox("ESC键");
    return TRUE;
    }
        }
    return CDialog::PreTranslateMessage(pMsg);
    }
      

  5.   

    你可以试一下 rebuild all 看看有没有错