• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

How to change a member variable in another dialog?

In one dialog, I hope to change a member variable(it's type is CStringArray) in another dialog.(The two dialogs exist at the same time)
How to implement this?
0
Zhu051200
Asked:
Zhu051200
1 Solution
 
gonuguntaCommented:
what do you want to change - value or type
0
 
abancroftCommented:
Are these non-modal in the same application? If so, you could do this:

class CDialog1 : public CDialog
{
  // Missing stuff...

public
  CStringArray m_Str;
};

class CDialog2 : public CDialog
{
  // Missing stuff...

public
  CDialog1 *m_pDlg1;
};

CDialog1 dlg1;
CDialog2 dlg2;

dlg2.m_pDlg1 = &dlg1;

dlg1.Create();
dlg2.Create();

Now dlg2 has access to dlg1.m_Str through it's m_pDlg1 member. Obviously, it'd be a good idea to encapsulate the public members.
0
 
Zhu051200Author Commented:
thanks for your help!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now