modal, modeless and variable
-
There are two classe of dialog windows: class CMainDlg2 : public Cdialog // modal CString m_sADDRESSHOM; class CAdderDialog2 : public CDialog // MODELESS #include "adderdlg2.h" #include "modeldlg2.h" There are in the code attached to command button OK set: m_pModeless7 = new CAdderDialog2(this); if (m_pModeless7->Create() == TRUE) { m_sADDRESSHOM = "London"; } View the fragment of code modeless window: BOOL CAdderDialog2::OnInitDialog() { CDialog::OnInitDialog(); CMainDlg2 dlg7; MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM); // display empty - the contents from constructor of modal dialog window } How to receive "London" ?
-
There are two classe of dialog windows: class CMainDlg2 : public Cdialog // modal CString m_sADDRESSHOM; class CAdderDialog2 : public CDialog // MODELESS #include "adderdlg2.h" #include "modeldlg2.h" There are in the code attached to command button OK set: m_pModeless7 = new CAdderDialog2(this); if (m_pModeless7->Create() == TRUE) { m_sADDRESSHOM = "London"; } View the fragment of code modeless window: BOOL CAdderDialog2::OnInitDialog() { CDialog::OnInitDialog(); CMainDlg2 dlg7; MessageBox(L"dlg7.m_sADDRESSHOM=\n" + dlg7.m_sADDRESSHOM); // display empty - the contents from constructor of modal dialog window } How to receive "London" ?
Pass the pointer of the first dialog in the modeless one as you are doing by passing this. Write a get/set function in the modal dialog and declare variable that will be used in get/set functions. Create a pointer variable for the modal dialog in the modeless one and initialize it in the constructor of the modeless dialog since you pass the this pointer. This done, you can invoke the get/set function and set the value in the string to what ever you wish using the modal dialog pointer in the modeless dialog. Alternatively, you can access the values using the dlg7 object as well. Hope it is clear.
You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_