<分区>
我在扩展 WinApp 的类的 InitInstance 函数中得到了这段代码:
m_pMainWnd = &m_Frame; // Clearly setting m_pMainWnd to !NULL
m_Frame.LoadFrame(BMP_ICON, 0, NULL, NULL);
m_pMainWnd->GetMenu()->Detach();
m_pMainWnd->SetMenu(NULL);
m_Frame.ShowWindow(SW_SHOW);
m_Frame.UpdateWindow();
然而,在运行时,应用程序打开,显示 m_Frame 大约一毫秒,然后再次关闭。我得到这个输出:
Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application.
The thread 'Win32 Thread' (0x914) has exited with code 0 (0x0).
The program '[6628] VentSizerPro.exe: Native' has exited with code 0 (0x0).
所以 m_pMainWnd 沿线的某处已更改为 NULL,但是在哪里、为什么、如何以及什么? :(
编辑:
m_Frame 是扩展 CFrameWnd 以修改窗口框架的类的实例。