C++ 从子对话框访问变量
我有一个儿童对话。我启动其他子对话框。 在第二个对话框中,我有以下列表框代码。 我需要在第一个子对话框中访问m_sel组件。我很想像这样访问它 dlg->m_选择组件。但它正在变为空。我该怎么做?谢谢你的帮助C++ 从子对话框访问变量,c++,visual-c++,mfc,C++,Visual C++,Mfc,我有一个儿童对话。我启动其他子对话框。 在第二个对话框中,我有以下列表框代码。 我需要在第一个子对话框中访问m_sel组件。我很想像这样访问它 dlg->m_选择组件。但它正在变为空。我该怎么做?谢谢你的帮助 int count = m_OutList.GetCount(); for ( i = 0; i <m_OutList.GetCount(); i++) { m_OutList.GetText( buf[i], text ); m_selc
int count = m_OutList.GetCount();
for ( i = 0; i <m_OutList.GetCount(); i++)
{
m_OutList.GetText( buf[i], text );
m_selcomponents->Add(text);
}
MSelCFLCompDlg *SelCflCompDlg= new MSelCFLCompDlg(&allcomponents, &m_cflcomponents,m_FileDecimal,this) ;
创建子对话框时,将指向父对话框的指针传递给子对话框构造函数。如果您向我们展示更多的代码,我也许可以更详细地解释一下
MSelCFLCompDlg::MSelCFLCompDlg(CStringArray *all, CStringArray *sel,int, CWnd* pParent /*=NULL*/)
: CDialog(MSelCFLCompDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(MSelCFLCompDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_allcomponents = all;
m_selcomponents = sel;
}