| Phiru (105) | |
|
Hi, I have a question. In CWinApp, InitInstance() func has those things. ... CMyDlg tdlg; m_pMainWnd = &tdlg; INT_PTR ret=tdlg.DoModal(); .. I wanted to show another dlg right after CMydlg destoryed, so I did like this. CMyDlg tdlg; m_pMainWnd = &tdlg; INT_PTR ret=tdlg.DoModal(); if(ret == IDOK) {} else if(IDCANCEL) { return FALSE;} CMyDlg2 tdlg2; m_pMainWnd = &tdlg2; tdlg2.doModal(); ... However, once CMyDlg returns IDOK, CMyDlg2.doModal()'s also termiated. I need to know mfc process or something related to the reason i mentioned. Anyone explain and help me. Thanks. :) | |
|
Last edited on
|
|
| guestgulkan (2916) | |
| Have you not already asked this question 3 weeks ago?? | |
|
|
|
| Phiru (105) | |
| I guess i did. but i needed to arrange my question cuz what I asked was not that clear. So, I re-post it. Plz understand me. :) | |
|
|
|
| guestgulkan (2916) | |||||
|
It is all the way that MFC works: The CWinApp class is derived from The CWinThread class. The m_pMainWnd member is in the CWinThread baseclass. When the main window dies, then the CWinThread also effectively dies. so when you first do this:
But once that first Dialogbox finishes, it also finishes the associated thread so when you try to use it again
| |||||
|
Last edited on
|
|||||
| LowestOne (896) | |
If you have a dialog box you should be able to call doModal until the cows come home.while (dB.doModal() == IDOK);
| |
|
|
|
| guestgulkan (2916) | |
|
@ LowestOne - Not quite. we are talking MFC and about changing the m_pMainWnd member of the CWinApp. | |
|
|
|
| Phiru (105) | |
|
Thanks all. And I got your saying, guestgulkan. Thank you again. | |
|
|
|