[请教]MFC建立的对话框程序在主窗口InitInstance()函数里面无法建立窗口原因,请高手指点!

[请教]MFC建立的对话框程序在主窗口InitInstance()函数里面无法建立窗口原因,请高手指点!

vc6,建立MFC对话框程序,主窗口的InitInstance()里面,运行SDK的API函数MessageBox(),都无法看见弹出的窗口。如:
BOOL CMyText::InitInstance()
{
#ifdef _AFXDLL
          Enable3dControls();   // Call this when using MFC in a shared DLL
#else
          Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

          CMyTextDlg dlg;
          m_pMainWnd = &dlg;
          int nResponse = dlg.DoModal();
          if (nResponse == IDOK)
          {
                    // TODO: Place code here to handle when the dialog is
                    //  dismissed with OK
            }
          else if (nResponse == IDCANCEL)
          {
           // TODO: Place code here to handle when the dialog is
           //  dismissed with Cancel
           MessageBox(NULL,"haha","aa",MB_OK);   //不会出现
          }

          // Since the dialog has been closed, return FALSE so that we exit the
          //  application, rather than start the application's message pump.
          return FALSE;
         }

上例中的MessageBox(),运行时一跳而过,看不见窗口。听的减弹出窗口的声音。不知道为什么,网上有人提出分析这样的问题。其他窗口也无法生成。但是不知为何。一种解决方法是注释掉m_pMainWnd = &dlg;这句即可正常。我试了,的确如此!

那位高手或知之者路过请解答!谢谢!

                                                                                                           ---------------------saga.constantine
                                                                                                                             

你可能感兴趣的:([请教]MFC建立的对话框程序在主窗口InitInstance()函数里面无法建立窗口原因,请高手指点!)