From 905410fde2caa66c1fd961ae6e0018bc1ff8f1d1 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Sat, 19 Feb 2022 14:50:29 +0800 Subject: [PATCH] no message --- examples/proto_debuger/base_form.cpp | 26 +++++++++++++++++++ examples/proto_debuger/msgdef.h | 2 +- .../proto_debuger/tcp_server_libevent.cpp | 3 --- examples/proto_debuger/udp_form.cpp | 4 +++ examples/proto_debuger/udp_group_form.cpp | 4 ++- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/examples/proto_debuger/base_form.cpp b/examples/proto_debuger/base_form.cpp index d8c49a06..8d3747e5 100644 --- a/examples/proto_debuger/base_form.cpp +++ b/examples/proto_debuger/base_form.cpp @@ -64,7 +64,32 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) } SerialPort::ClosePort(PortNum); } + if (uMsg == WM_USER_UDP_GROUP_CLOSE) { + if (mRightShow == nullptr) + return true; + wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str()); + mRightShow->SetVisible(false); + mRightShow = nullptr; + mRightSide->SetAutoDestroy(true); + mRightSide->RemoveAll(); + mUdpForm.erase(*(wstring*)(wParam)); + int cnt = mMonitor->GetRootNode()->GetChildNode(4)->GetChildNodeCount(); + ui::TreeNode* p = nullptr; + for (int i = 0; i < cnt; i++) { + if (mMonitor->GetRootNode()->GetChildNode(4)->GetChildNode(i)->GetText() + == *(wstring*)(wParam)) { + p = mMonitor->GetRootNode()->GetChildNode(4)->GetChildNode(i); + break; + } + + } + mMonitor->GetRootNode()->GetChildNode(4)->RemoveChildNode(p); + delete mRightShow; + mRightShow = nullptr; + } if (uMsg == WM_USER_UDP_CLOSE) { + if (mRightShow == nullptr) + return true; wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str()); mRightShow->SetVisible(false); mRightShow = nullptr; @@ -252,6 +277,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) mUdpForm[pdata] = form; if (!mRightSide->Add(form)) printf("error 1"); + } node->AttachAllEvents( [this](ui::EventArgs* ev) { diff --git a/examples/proto_debuger/msgdef.h b/examples/proto_debuger/msgdef.h index 0f848bfd..30b721ae 100644 --- a/examples/proto_debuger/msgdef.h +++ b/examples/proto_debuger/msgdef.h @@ -3,7 +3,6 @@ #define WM_USER_POS_CHANGED (WM_USER + 2) #define WM_ADD_UART_MONITOR (WM_USER + 3) #define WM_ADD_TCPCLIENT_MONITOR (WM_USER + 4) - #define WM_ADD_UART_RECVDATA (WM_USER + 5) #define WM_ADD_UART_CLOSE (WM_USER + 6) #define WM_ADD_TCPSERVER_MONITOR (WM_USER + 7) @@ -13,3 +12,4 @@ #define WM_USER_UDP_CLOSE (WM_USER + 10) #define WM_USER_TCP_CLIENT_CLOSE (WM_USER + 11) #define WM_USER_TCP_SERVER_CLOSE (WM_USER + 12) +#define WM_USER_UDP_GROUP_CLOSE (WM_USER + 13) diff --git a/examples/proto_debuger/tcp_server_libevent.cpp b/examples/proto_debuger/tcp_server_libevent.cpp index 4759feb8..807e817a 100644 --- a/examples/proto_debuger/tcp_server_libevent.cpp +++ b/examples/proto_debuger/tcp_server_libevent.cpp @@ -236,9 +236,6 @@ void ServerCallbacks::server_run(TcpServerLibevent* p) { } } } - - - /** * @description: * @param {*} diff --git a/examples/proto_debuger/udp_form.cpp b/examples/proto_debuger/udp_form.cpp index b5802998..09fdd72d 100644 --- a/examples/proto_debuger/udp_form.cpp +++ b/examples/proto_debuger/udp_form.cpp @@ -58,8 +58,12 @@ void UdpForm::Init() ui::Button* m_button_3 = dynamic_cast(FindSubControl(L"btn_save_lua")); ui::Button* m_button_4 = dynamic_cast(FindSubControl(L"btn_do_lua")); + + + m_label_1 = dynamic_cast(FindSubControl(L"uart_info_label")); m_rich_edit_1 = dynamic_cast(FindSubControl(L"uart_recv_eidt")); + if (nullptr != m_rich_edit_1) { m_rich_edit_1->SetReadOnly(true); m_rich_edit_1->SetRich(false); diff --git a/examples/proto_debuger/udp_group_form.cpp b/examples/proto_debuger/udp_group_form.cpp index a1983c8a..27441e8d 100644 --- a/examples/proto_debuger/udp_group_form.cpp +++ b/examples/proto_debuger/udp_group_form.cpp @@ -98,7 +98,9 @@ void UdpGroupForm::Init() if (nullptr != m_button_2) { m_button_2->AttachClick( [this](ui::EventArgs*) { - + wstring* name = new wstring(this->GetName()); + ::PostMessage(this->GetWindow()->GetHWND(), + WM_USER_UDP_GROUP_CLOSE, (WPARAM)name, 0); return true; } );