0

I am opening a CDialog(CAxDialogImpl) using m_nRet = DoModal();

On this dialog I have an options button. When I click on this options button, I need to close this existing dialog and open another dialog (my options dialog). In order to close the existing dialog, I first call EndDialog(m_nRet) and then call DoModal() again to open my options dialog.

I am able to successfully close and reopen another dialog. However, when I try to close this new options dialog, my IE page in the background refreshes with a message:

A problem with this webpage caused Internet Explorer to close and reopen the tab.

I am new to this technology and would appreciate your help. Thank you!

starsplusplus
  • 1,232
  • 3
  • 19
  • 32
Maya
  • 95
  • 1
  • 3
  • 7
  • are you calling `DoModal()` for your options dialog from within the first dialog class (i.e. at the same place where you call `EndDialog()`)? – Edward Clements Apr 11 '14 at 06:10
  • Hi Edward, thank you for your response! Yes, I am calling DoModal() for the options dialog from the first dialog class(where I call EndDialog(). – Maya Apr 11 '14 at 14:54
  • this will definitely cause unpredictable behaviour -- see answer below – Edward Clements Apr 11 '14 at 16:04

1 Answers1

0

When the options button is clicked, you will need to either set up a member variable (e.g.: m_bInvokeOptionsDlg) or a unique return value and exit the dialog.

The calling function should then check this value and invoke the options dialog box. Once the call returns, you could loop back and open the initial dialog again.

Another alternative would be to invoke the options dialog box directly when the options button is clicked, but then both the dialog boxes would be visible.

Edward Clements
  • 5,040
  • 2
  • 21
  • 27