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