Interaction between dialog boxes
-
Hi!! I am working on an SDI MFC application. I have two dialog boxes. I want to pass some File name from one dialog box to another on clicking OK command button. The file name has to be displayed on the text box of second dialog, when the second dialog appears on the screen . Can any body tell me , how to declare variables and wat functions to use. I am new to MFC. Thanx
-
Hi!! I am working on an SDI MFC application. I have two dialog boxes. I want to pass some File name from one dialog box to another on clicking OK command button. The file name has to be displayed on the text box of second dialog, when the second dialog appears on the screen . Can any body tell me , how to declare variables and wat functions to use. I am new to MFC. Thanx
there are two methods (1)use CWnd::SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ); (2)you can add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second Dialog access it. libo
-
there are two methods (1)use CWnd::SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ); (2)you can add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second Dialog access it. libo
Hi! Thanx for giving responses to my problem. You had told me: "add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second Dialog access it." But, please tell me , that ,"how to pass the file name of the first dialog to the variable..." Can u tell me some code as I am new to mfc programming Thanx a lot for ur valuable time
-
Hi! Thanx for giving responses to my problem. You had told me: "add a variable in the CMainFrm. pass the File name of the first Dialog to the variable.then the second Dialog access it." But, please tell me , that ,"how to pass the file name of the first dialog to the variable..." Can u tell me some code as I am new to mfc programming Thanx a lot for ur valuable time
You have probably two classes derived from CDialog for your dialogs. Let them be (it's just an example) CYourDlg1 and CYourDlg2. I guess you are using them like that (supossing they are modal):
CYourDlg1 dlg1;
.
.
dlg1.DoModal()and
CYourDlg2 dlg2;
.
.
dlg2.DoModal()respectively. Now, let's say you want to pass some CString data (containing a fully qualified name of some file), which you get from dlg1, to dlg2. You must add some data member to each of those two classes:
CString m_strFile
. In the OnOK() function ofCYourDlg1
you add the line:m_strFile = ...
with the dots replaced by something you are using there (:-)). Before callingdlg2.DoModal()
, you initialize the data of dlg2 with data from dlg1:dlg2.m_strFile = dlg1.m_strFile
SkyWalker -- modified at 3:13 Sunday 9th October, 2005