How to make communication in different dialogues in MFC dialogue based application?

In my MFC dialogue based application one situation is that first I open model dialogue and click event of one of button of this dialogue ,it open main dialogue which contains Initinstance and OnInitDialog method in it, so when I clicked on back button of main dialogue ; one time it shows first dialog but second time it closes application! How to solve this problem?

Initialization of first dialog in InitInstance() and call DoModal() in OnInitdialog() of main dialogue. I used syntax for open main dialogue is OnOk() method so it disappeared first dialogue and main dialogue open,but when I am going to use DoModal() it gives runtime exception for open maindialog.
Thanks in advance!!
Topic archived. No new replies allowed.