From 0989cae80322e859f6e1f6d57398304ffe1bf4e1 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Tue, 14 Jan 2025 23:47:43 +0800 Subject: [PATCH] fix: #30 Don't open window when there's no camera --- server/2015Remote/2015RemoteDlg.cpp | 8 ++++++-- server/2015Remote/IOCPServer.h | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index fba2886..8365dee 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -361,7 +361,8 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName m_CList_Online.SetItemText(i, ONLINELIST_VERSION, ver); m_CList_Online.SetItemText(i, ONLINELIST_LOGINTIME, st); m_CList_Online.SetItemText(i, ONLINELIST_CLIENTTYPE, tp.IsEmpty()?"DLL":tp); - + CString data[10] = { strIP, strAddr,strPCName,strOS,strCPU,strVideo,strPing,ver,st,tp }; + ContextObject->SetClientInfo(data); m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject); ShowMessage(true,strIP+"主机上线"); @@ -829,7 +830,10 @@ VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength) { int iItem = m_CList_Online.GetNextSelectedItem(Pos); CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(iItem); - + if (szBuffer[0]== COMMAND_WEBCAM && ContextObject->sClientInfo[ONLINELIST_VIDEO] == CString("无")) + { + continue; + } // 发送获得驱动器列表数据包 m_iocpServer->OnClientPreSending(ContextObject,szBuffer, ulLength); } diff --git a/server/2015Remote/IOCPServer.h b/server/2015Remote/IOCPServer.h index c1cb835..93cd46c 100644 --- a/server/2015Remote/IOCPServer.h +++ b/server/2015Remote/IOCPServer.h @@ -25,6 +25,7 @@ enum IOType typedef struct _CONTEXT_OBJECT { + CString sClientInfo[10]; SOCKET sClientSocket; WSABUF wsaInBuf; WSABUF wsaOutBuffer; @@ -46,6 +47,12 @@ typedef struct _CONTEXT_OBJECT memset(&wsaOutBuffer,0,sizeof(WSABUF)); olps = NULL; } + VOID SetClientInfo(CString s[10]){ + for (int i=0; i ContextObjectList;