Duilib退出应用处理

Scroll Down

主窗口

void CMainWnd::OnClick(TNotifyUI& msg)
{
	CDuiString sName = msg.pSender->GetName();
	if (sName == "close_btn") {
		Close(0);
		return;
	}
}
LRESULT CMainWnd::OnClose(UINT, WPARAM, LPARAM, BOOL& bHandled)
{
	PostQuitMessage(0);
	return 0;
}
void CMainWnd::OnFinalMessage(HWND hWnd){
	__super::OnFinalMessage(hWnd);
	delete this;
}

子窗口

void CCreateWnd::OnClick(TNotifyUI& msg)
{
	CDuiString sName = msg.pSender->GetName();
	if (sName == "close_btn") {
		Close(0);
		return;
	}
}
void CCreateWnd::OnFinalMessage(HWND hWnd)
{
	__super::OnFinalMessage(hWnd);
	delete this;
}