Click X in the title bar to exit the program normally. The interface is destroyed but the background is still running. After reading the source code, click X to proceed to this process.
void WindowImplBase::OnClick(TNotifyUI& msg){CDuiString sCtrlName = msg.pSender->GetName();if( sCtrlName == _T("closebtn") ){Close(); return; }
void CWindowWnd::Close(UINT nRet){ ASSERT(::IsWindow(m_hWnd)); if( !::IsWindow(m_hWnd) ) return; PostMessage(WM_CLOSE, (WPARAM)nRet, 0L);}
This process throws the wm_close message, does not throw wm_quit, and reloads ondestroy to exit normally.
LRESULT CDYControlSystemFrameWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){::PostQuitMessage(0L);bHandled = FALSE;__super::OnDestroy(uMsg, wParam, lParam, bHandled);return 0;}
How to solve the problem that the duilib program cannot close normally by clicking X in the title bar