uusky 发表于 2005-9-9 11:22:00

[ARX]类之间成员调用问题 初学者的难题!

<P>建立了一个dlg类:CAttribute,对话框中IDD_ATTRIBUTE有Combo Box,其名字为:&nbsp; IDC_STYLE <BR>&nbsp; 其中的Data有:用地选址<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用地许可证<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用地设计要点</P>
<P>用向导建立成员如下:&nbsp;&nbsp; <BR>&nbsp; Control IDs:IDC_STYLE <BR>&nbsp; Type:CString<BR>&nbsp; Member:m_CS<BR>现在我需要在另一个类中调用attributeCommands.cpp:<BR>#include "StdAfx.h"<BR>#include "StdArx.h"<BR>#include&nbsp; "CAttribute.h"<BR>int choose()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (CAttribute::m_CS="用地选址")&nbsp; //这样写是错误的 谁能给个正确的方法?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1;<BR>else if( CAttribute::m_CS="用地许可证")<BR>return 2; <BR>else if (CAttribute::m_CS="用地设计要点")<BR>return 3; </P>
<P>}<BR>详细函数如下:<BR>CAttribute.h:<BR>class CAttribute : public CDialog<BR>{<BR>// Construction<BR>public:<BR>CAttribute(CWnd* pParent = NULL);&nbsp; <BR>enum { IDD = IDD_ATTRIBUTE };<BR>CString m_CS;<BR>&nbsp;&nbsp;&nbsp;&nbsp; .......<BR>触发事件:<BR>CAttribute.cpp:<BR>void CAttribute::OnOK() <BR>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_CS="用地选址")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; createNewLayernew("选址红线",m_CS); <BR>else if ( m_CS="市政要点")<BR>&nbsp; createNewLayernew("市政要点红线",m_CS); <BR>else<BR>&nbsp; createNewLayernew("其他红线",m_CS); <BR>}<BR>createNewLayernew(....){....}<BR></P>

uusky 发表于 2005-9-9 11:27:00

<P>C++的基本问题:其实问题就是一句话:<BR>&nbsp;&nbsp; 对话框类CAttribute的Combo Box的成员m_CS,在attributeCommands.cpp中如何调用!</P>
<P>&nbsp;</P>
<P>可惜我这个菜鸟研究了半天没成果!哪为大虾帮忙看看!</P>

uusky 发表于 2005-9-9 16:40:00

class A<BR>{<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp; int m_nCount;<BR>}<BR>A a;<BR>a.m_nCount = 0;<BR><BR>&nbsp;&nbsp; <INPUT type=hidden value=2096993 name=rid>
页: [1]
查看完整版本: [ARX]类之间成员调用问题 初学者的难题!