Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 从子对话框访问变量_C++_Visual C++_Mfc - Fatal编程技术网

C++ 从子对话框访问变量

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

我有一个儿童对话。我启动其他子对话框。 在第二个对话框中,我有以下列表框代码。 我需要在第一个子对话框中访问m_sel组件。我很想像这样访问它 dlg->m_选择组件。但它正在变为空。我该怎么做?谢谢你的帮助

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;

}