请教:error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'class CListBox'

tinlyjoanna 2008-07-24 09:37:16
// featuremodelingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "featuremodeling.h"
#include "featuremodelingDlg.h"
#include "lunpandlg.h"
#include <Cstring>
#include <iostream>
using std::operator ==;


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFeaturemodelingDlg dialog

CFeaturemodelingDlg::CFeaturemodelingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFeaturemodelingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFeaturemodelingDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFeaturemodelingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFeaturemodelingDlg)
DDX_Control(pDX, IDC_LIST1, m_sfeature);
DDX_Control(pDX, IDC_FEATURE, m_feature);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFeaturemodelingDlg, CDialog)
//{{AFX_MSG_MAP(CFeaturemodelingDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CANCEL, OnCancel)
ON_BN_CLICKED(IDC_DISPLAY, OnDisplay)
ON_BN_CLICKED(IDC_OK, OnOk)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFeaturemodelingDlg message handlers

BOOL CFeaturemodelingDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here
strcpy(lunpan[0],"涡轮盘体");
strcpy(suncao[0],"半圆弧两齿榫槽");
strcpy(suncao[1],"常规三齿榫槽");
strcpy(suncao[2],"常规四齿榫槽");
strcpy(suncao[3],"常规五齿榫槽");
strcpy(suncao[4],"双榫根榫槽");
strcpy(anzhuangbian[0],"销钉连接");
strcpy(anzhuangbian[1],"短螺栓连接");
strcpy(anzhuangbian[2],"套齿连接");
strcpy(anzhuangbian[3],"长螺栓连接");
strcpy(anzhuangbian[4],"焊接");
strcpy(anzhuangbian[5],"端面齿连接");
strcpy(fujiajiegou[0],"前篦齿环");
strcpy(fujiajiegou[1],"后篦齿环");
strcpy(fujiajiegou[2],"前平衡配重环");
strcpy(fujiajiegou[3],"后平衡配重环");
strcpy(fujiajiegou[4],"冷却孔");
strcpy(fujiajiegou[5],"均压孔");
strcpy(fujiajiegou[6],"鼓筒");
strcpy(pan,"轮盘");
strcpy(cao,"榫槽");
strcpy(bian,"安装边");
strcpy(fujia,"附加结构");
this->m_feature.AddString((LPCTSTR)pan);
this->m_feature.AddString((LPCTSTR)cao);
this->m_feature.AddString((LPCTSTR)bian);
this->m_feature.AddString((LPCTSTR)fujia);
this->m_feature.SetCurSel(0);
this->m_feature.EnableWindow(TRUE);
UpdateData(FALSE);

return TRUE; // return TRUE unless you set the focus to a control
}

void CFeaturemodelingDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CFeaturemodelingDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CFeaturemodelingDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}


void CFeaturemodelingDlg::OnDisplay()
{
// TODO: Add your control notification handler code here
CString m_getstring;
int icount;
UpdateData(TRUE);
this->m_feature.GetLBText(m_feature.GetCurSel(),m_getstring);
this->m_sfeature.ResetContent();
if(m_getstring==(CString)pan)
{
for(icount=0;icount<1;icount++)
this->m_sfeature.AddString((LPSTR)lunpan[icount]);
this->m_sfeature.SetCurSel(0);
}
if(m_getstring==(CString)cao)
{
for(icount=0;icount<5;icount++)
this->m_sfeature.AddString((LPSTR)suncao[icount]);
this->m_sfeature.SetCurSel(0);
}
if(m_getstring==(CString)bian)
{
for(icount=0;icount<6;icount++)
this->m_sfeature.AddString((LPSTR)anzhuangbian[icount]);
this->m_sfeature.SetCurSel(0);
}
if(m_getstring==(CString)fujia)
{
for(icount=0;icount<7;icount++)
this->m_sfeature.AddString((LPSTR)fujiajiegou[icount]);
this->m_sfeature.SetCurSel(0);
}
}

void CFeaturemodelingDlg::OnOk()
{
// TODO: Add your control notification handler code here
CString sfeature;
this->m_sfeature.GetText(m_sfeature.GetCurSel(),sfeature);
if(m_sfeature==(CString)lunpan[0])
{Clunpandlg dlg;
dlg.DoModal();
}


}

void CFeaturemodelingDlg::OnCancel()
{
// TODO: Add your control notification handler code here

}


本人刚刚入门,请求高手指点啊
...全文
413 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Conry 2008-07-24
  • 打赏
  • 举报
回复

变量写错了



void CFeaturemodelingDlg::OnOk()
{
// TODO: Add your control notification handler code here
CString sfeature;
this->m_sfeature.GetText(m_sfeature.GetCurSel(),sfeature);
if(sfeature==(CString)lunpan[0])
{Clunpandlg dlg;
dlg.DoModal();
}

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧