How to solve the problem that the duilib program cannot close normally by clicking X in the title bar

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.