明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1835|回复: 1

为什么m_x已在ScaleDlg.h中定义过,而在ScaleDlg.cpp却不认可?

[复制链接]
发表于 2002-12-20 10:34 | 显示全部楼层 |阅读模式
ScaleDlg.h文件内容:

#if !defined(AFX_SCALEDLG_H__883BC861_1336_11D7_A714_885276570047__INCLUDED_)
#define AFX_SCALEDLG_H__883BC861_1336_11D7_A714_885276570047__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ScaleDlg.h : header file
//
#include "resource.h"
#include <adslib.h>
#include <adui.h>
#include <acui.h>

/////////////////////////////////////////////////////////////////////////////
// CScaleDlg dialog

class CScaleDlg : public CAcUiDialog
{
// Construction
public:
        CScaleDlg(CWnd* pParent = NULL);   // standard constructor
    void DisplayComboBox();
// Dialog Data
        //{{AFX_DATA(CScaleDlg)
        enum { IDD = IDD_DIALOG1 };
        CAcUiSymbolComboBox        m_x;
        CAcUiSymbolComboBox        m_y;
        CAcUiSymbolComboBox        m_p;
        //}}AFX_DATA


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

// Implementation
protected:

        // Generated message map functions
        //{{AFX_MSG(CScaleDlg)
        virtual BOOL OnInitDialog();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SCALEDLG_H__883BC861_1336_11D7_A714_885276570047__INCLUDED_)


ScaleDlg.cpp文件内容:

// ScaleDlg.cpp : implementation file
//

#include "StdAfx.h"
#include "ScaleDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CScaleDlg dialog


CScaleDlg::CScaleDlg(CWnd* pParent /*=NULL*/)
        : CAcUiDialog(CScaleDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CScaleDlg)
        //}}AFX_DATA_INIT
}


void CScaleDlg::DoDataExchange(CDataExchange* pDX)
{
        CAcUiDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CScaleDlg)
        DDX_Control(pDX, IDC_COMBO_X, m_x);
        DDX_Control(pDX, IDC_COMBO_Y, m_y);
        DDX_Control(pDX, IDC_COMBO_P, m_p);
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CScaleDlg, CAcUiDialog)
        //{{AFX_MSG_MAP(CScaleDlg)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScaleDlg message handlers

BOOL CScaleDlg::OnInitDialog()
{
        CAcUiDialog::OnInitDialog();
        // TODO: Add extra initialization here
   DisplayComboBox();
   return TRUE;  // return TRUE unless you set the focus to a control
                      // EXCEPTION: OCX Property Pages should return FALSE
}

void DisplayComboBox()
{
m_x.InsertString(-1,"good");
}

编译出现:

d:\LX\scale\ScaleDlg.cpp(55) : error C2065: 'm_x' : undeclared identifier
d:\LX\scale\ScaleDlg.cpp(55) : error C2228: left of '.InsertString' must have class/struct/union type

这是为什么?为什么m_x已经在ScaleDlg.h文件中定义过,而在ScaleDlg.cpp的
void DisplayComboBox()
{
m_x.InsertString(-1,"good");
}
中,却不认可?
请各位高手帮助一下,谢谢!
e_mail:msd0819@mail.dlptt.ln.cn
发表于 2002-12-20 10:38 | 显示全部楼层

回复

你的程序中
void DisplayComboBox()
{
m_x.InsertString(-1,"good");
}
应为
void CScaleDlg::DisplayComboBox()
{
m_x.InsertString(-1,"good");
}
就行了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-3 00:01 , Processed in 0.344478 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表