no message

This commit is contained in:
zcy 2022-01-09 11:00:38 +08:00
parent 81d3e557ec
commit 253dc96394
4 changed files with 12 additions and 10 deletions

View File

@ -83,8 +83,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
node->SetMargin({ 20, 0, 0, 0 });
mMonitor->GetRootNode()->GetChildNode(1)->AddChildNode(node);
gTcpClientCnt++;
if (mTcpClientForm.find(info->ip + L":"
+ std::to_wstring(gTcpClientCnt)) == mTcpClientForm.end())
if (mTcpClientForm.find(key) == mTcpClientForm.end())
{
auto form = new TcpClientForm(this,wstring2string(info->ip),info->port, cli);
form->SetChildLayoutXML(L"basic/tcp_form.xml");
@ -92,7 +91,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
form->SetVisible(false);
mTcpClientForm[key] = form;
if (!mRightSide->Add(form))
printf("erroer 1");
printf("error 1");
}
node->AttachAllEvents([this](ui::EventArgs* ev) {
if (ui::EventType::kEventSelect == ev->Type) {
@ -128,7 +127,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
TcpServerInfo* info = (TcpServerInfo*)wParam;
TcpServerLibevent* server = (TcpServerLibevent*)lParam;
ui::TreeNode* node = new ui::TreeNode;
auto key = info->ip + L":" + std::to_wstring(gTcpServerCnt);
auto key = info->ip + L":" + std::to_wstring(info->port);
node->SetText(key);
node->SetClass(L"listitem");
node->SetFixedHeight(20);

View File

@ -133,8 +133,6 @@ void NewMonitorForm::InitWindow()
}
}
if (m_combo_type->GetText() == L"tcp client") {
wprintf(L"%s\r\n", m_ip_select->GetText().c_str());
wprintf(L"%s\r\n", m_port_select->GetText().c_str());
@ -144,9 +142,7 @@ void NewMonitorForm::InitWindow()
p->ip = m_ip_select->GetText();
p->port = port;
p->socket_fd = m_tcp_client->SocketFd();
printf("Á¬½Ó³É¹¦ %d \r\n", p->socket_fd);
auto succ = ::PostMessage(m_parent->GetHWND(),
WM_ADD_TCPCLIENT_MONITOR, (WPARAM)p, (LPARAM)m_tcp_client);
if (!succ) {

View File

@ -59,9 +59,16 @@ void TcpServerFrom::Init()
void TcpServerFrom::OnNewConnAccept(ConnectionLibevent*p)
{
std::cout << "TcpServerFrom OnNewConnAccept addr " << p->IpAddress()<<std::endl;
std::cout << "TcpServerFrom OnNewConnAccept addr " << p->IpAddress()<<p->SocketFd()<<std::endl;
updateStatus();
auto element = new ui::ListContainerElement;
element->SetClass(L"listitem");
element->SetFixedHeight(30);
element->SetBkColor(L"white");
element->SetTextPadding({ 6,0,6,0 });
element->SetText(std::to_wstring(p->SocketFd()));
m_combo_1->Add(element);
return;
}