Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing data between Dialogs

Status
Not open for further replies.

zoomby

Programmer
Aug 5, 2002
60
DE
hi!

What is the best method to pass data between dialogs when using MFC?

bye
Chris
 
There are no best methods for all cases.
You can use Windows message, a variables of dialogs, static/global variable, Registry, File, Atom Table, Database etc...
If You say, what do You wish to do, I (may be) can say, what is the best solution.
 
hi!

Imagine you have two dialog classes, and want to pass some variables to the one dialog, when you close the other one.
Do I have to declare global variables or is there a better way?

bye
 
If the destination Dialog exists before source Dialog was closed, You can do it directly:
1. Make destination dialog class known for source dialog (#include "source_dlg.h" in File destination_dlg.c).
2. Make destination dialog pointer known for source dlg (for example, make global variable of typ pointer
and init it in constructor of destination dialog throw 'this').
3. Make in OnOK() - Funktion of source Dialog all You wish with destination dialog (I suppose, You wish to save parameters by OK only).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top