no message

This commit is contained in:
zcy 2022-02-19 00:53:51 +08:00
parent 4667077c30
commit e44f576a79
3 changed files with 30 additions and 2 deletions

View File

@ -105,7 +105,26 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
delete mRightShow;
mRightShow = nullptr;
}
if (uMsg == WM_USER_TCP_SERVER_CLOSE) {
wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str());
mRightShow->SetVisible(false);
mRightSide->SetAutoDestroy(true);
mRightSide->RemoveAll();
mTcpServerForm.erase(*(wstring*)(wParam));
int cnt = mMonitor->GetRootNode()->GetChildNode(2)->GetChildNodeCount();
ui::TreeNode* p = nullptr;
for (int i = 0; i < cnt; i++) {
if (mMonitor->GetRootNode()->GetChildNode(2)->GetChildNode(i)->GetText()
== *(wstring*)(wParam)) {
p = mMonitor->GetRootNode()->GetChildNode(2)->GetChildNode(i);
break;
}
}
mMonitor->GetRootNode()->GetChildNode(2)->RemoveChildNode(p);
delete mRightShow;
mRightShow = nullptr;
}
if (uMsg == WM_USER_POS_CHANGED) {
}

View File

@ -74,7 +74,6 @@ void TcpClientForm::Init()
WM_USER_TCP_CLIENT_CLOSE, (WPARAM)name, 0);
return true;
});
}
m_btn_send_data->AttachAllEvents([this](ui::EventArgs* ev) {

View File

@ -2,7 +2,7 @@
#include "utils.h"
#include <functional>
#include "lua_bind.h"
#include "msgdef.h"
extern "C" {
#include "event2/bufferevent.h"
#include "event2/buffer.h"
@ -80,6 +80,16 @@ void TcpServerFrom::Init()
m_button_3 = dynamic_cast<ui::Button*>(FindSubControl(L"btn_do_lua"));
m_btn_save_lua = dynamic_cast<ui::Button*>(FindSubControl(L"btn_save_lua"));
if (m_button_2 != nullptr) {
m_button_2->AttachClick([this](ui::EventArgs* ev) {
wstring* name = new wstring(this->GetName());
::PostMessage(this->GetWindow()->GetHWND(),
WM_USER_TCP_SERVER_CLOSE, (WPARAM)name, 0);
return true;
});
}
if (nullptr != m_button_1) {
m_button_1->AttachClick([this](ui::EventArgs* ev) {
auto client = m_combo_1->GetText();