Open GoogleCodeExporter opened 9 years ago
子窗口以ShowModal模式创建,这时通过托盘菜单给主窗口PostMess age(WM_CLOSE) 方式退出程序时,会导致程序崩溃。试了一下ShowModal源码 UINT CWindowWnd::ShowModal() { ASSERT(::IsWindow(m_hWnd)); UINT nRet = 0; HWND hWndParent = GetWindowOwner(m_hWnd); ::ShowWindow(m_hWnd, SW_SHOWNORMAL); ::EnableWindow(hWndParent, FALSE); MSG msg = { 0 }; while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) { if( msg.message == WM_CLOSE && msg.hwnd == m_hWnd ) { nRet = msg.wParam; ::EnableWindow(hWndParent, TRUE); ::SetFocus(hWndParent); } if( !CPaintManagerUI::TranslateMessage(&msg) ) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } if( msg.message == WM_QUIT ) break; } ::EnableWindow(hWndParent, TRUE); ::SetFocus(hWndParent); if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam); return nRet; } 这里收到主窗口WM_CLOSE消息没做处理。
Original issue reported on code.google.com by wxl_...@hotmail.com on 20 Jun 2013 at 2:40
wxl_...@hotmail.com
Original issue reported on code.google.com by
wxl_...@hotmail.com
on 20 Jun 2013 at 2:40