| Phiru (105) | |
|
I customize a dialog like blow. class ScDlg : public CDialog {.... DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg void OnPaint(); } And I made two classes based on ScDlg. FirstDlg : ScDlg SecondDlg : ScDlg then I declare both two classes in App class like this. FirstDlg dlg1; m_pMainWnd = &dlg1; INT_PTR nResponse1 = dlg1.DoModal(); if (nResponse1 == IDOK){ } else if (nResponse1 == IDCANCEL){return false;} SecondDlg dlg2; m_pMainWnd = &dlg2; INT_PTR nResponse2 = dlg2.DoModal(); if (nResponse2 == IDOK){ } else if (nResponse2 == IDCANCEL){return false;} First dlg perfectly works. When I pressed OK button, it returns IDOK. However, dlg2.DoModal() immediately returns -1. I don't know why. Please help me. I need your help. Thanks. | |
|
|
|
| guestgulkan (2915) | |||
|
After some research - I have come to the conclusion that you cannot change the m_pMainWnd the way you are doing it. This might be a better way for your problem;
In reality it seems you don't need to set the CWinApp m_pMainWnd at all - so you should be able to leave it alone in this case. | |||
|
Last edited on
|
|||
| Phiru (105) | |
|
Thanks guestgulkan. It works.!!! | |
|
|
|