1

子ダイアログがあります。他の子ダイアログを開始します。2番目のダイアログには、リストボックスの次のコードがあります。最初の子ダイアログでm_selcomponentsにアクセスする必要があります。dlg->m_selcomponentsのようにこれにアクセスしようとしました。しかし、それはnullになりつつあります。これどうやってするの?助けてくれてありがとう。

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) ; 

if(SelCflCompDlg-> DoModal()== IDOK){selectedcomponents.Append(* SelCflCompDlg-> m_selcomponents); }

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;

}
4

1 に答える 1

0

子ダイアログボックスを作成するときは、親ダイアログボックスへのポインターを子ダイアログボックスコンストラクターに渡します。コードをもう少し見せていただければ、もう少し詳しく説明できるかもしれません。

于 2012-11-17T17:32:59.450 に答える