CMyDialog mydialog; // Initialize dialog data mydialog.membervariable1 = MyPermanentVariable1; mydialog.membervariable2 = MyPermanentVariable2; // Invoke the dialog box if (mydialog.DoModal() == IDOK) { // retrieve the dialog data MyPermanentVariable1 = mydialog.membervariable1; MyPermanentVariable1 = mydialog.membervariable1; }