资源简介
本软件可以实现远程桌面的功能,类似TeamViewer,用VC++实现的
代码片段和文件信息
// 从服务器端接收桌面屏幕
#include
#include
#include
#include “client.h“
#include “command.h“
#include “gdi.h“
#include “HuffCompress.h“
#include “RLE.h“
#include “time.h“
#define DEFAULT_PORT 5150
#define REFRESH_MSG “REFRESH“
#define SETFLAGS XP1_GUARANTEED_DELIVERY|XP1_GUARANTEED_ORDER
#define NOTSETFLAGS XP1_CONNECTIONLESS
#define LPBMIH LPBITMAPINFOHEADER
UINT port=DEFAULT_PORT;
BOOL bSendOnly = FALSE;
BOOL fSending = FALSE;
BOOL fReceiving = FALSE;
DWORD iLen;
char *pDIBitmap;
int iScreenWidthiScreenHeight;
int iWidthiHeightiWidthXiHeightY;
int iWidth1iWidth2iHeight1iHeight2;
int iCompressionLevel;
BOOL fDIBitmap = FALSE;
LPBMIH lpBitmapIH;
struct sockaddr_in server;
SOCKET sClient;
BOOL fRefreshing = FALSE;
BOOL fConnected = FALSE;
int nGridX = 8nGridY = 4;
BOOL fGridX = FALSEfGridY = FALSE;
WORD bmBitsPixel = 4;
struct GdiList GdiStart;
struct GdiList *pGdiNode;
int SelectProtocols(DWORD dwSetFlagsDWORD dwNotSetFlagsLPWSAPROTOCOL_INFO lpProtocolBufferLPDWORD lpdwBufferLengthWSAPROTOCOL_INFO *Protocol);
void InitGrids()
{
int iLoopjLoopnGrid;
struct GdiDS Gdi;
Gdi.fDIBitmap = FALSE;
GdiStart.pNext = NULL;
pGdiNode = &GdiStart;
if ((nGridX > 0) && (nGridY > 0))
{
for (iLoop = 0;iLoop < nGridX;iLoop++)
{
for (jLoop = 0;jLoop < nGridY;jLoop++)
{
Gdi.iGridX = iLoop;
Gdi.iGridY = jLoop;
pGdiNode = Add_Gdi(pGdiNodeGdi);
}
}
}
else
{
nGrid = max(nGridXnGridY);
for (iLoop = 0;iLoop < nGrid;iLoop++)
{
if (nGridX > 0)
Gdi.iGridX = iLoop;
else
Gdi.iGridX = 0;
if (nGridY > 0)
Gdi.iGridY = iLoop;
else
Gdi.iGridY = 0;
pGdiNode = Add_Gdi(pGdiNodeGdi);
}
}
if (nGridX > 0)
iWidthX = iWidth/nGridX;
else
iWidthX = iWidth;
if (nGridY > 0)
iHeightY = iHeight/nGridY;
else
iHeightY = iHeight;
}
// 装入Winsock然后连接服务器
int LoadWinsock(HWND hWndchar *szIP)
{
WSADATA wsd;
DWORD dwLen;
int nRetnZero;
LPBYTE pBuf;
WSAPROTOCOL_INFO Protocol;
char szString[81];
char szMessage[81];
if (WSAStartup(0x202&wsd) != 0)
{
MessageBox(NULL“hehe““Client Socket Error“MB_OK);
return 1;
}
dwLen = 0;
nRet = WSAEnumProtocols(NULLNULL&dwLen);
if (nRet == SOCKET_ERROR)
{
if (WSAGetLastError() != WSAENOBUFS)
return 1;
}
pBuf = malloc(dwLen);
nRet = SelectProtocols(SETFLAGSNOTSETFLAGS(LPWSAPROTOCOL_INFO)pBuf&dwLen&Protocol);
free(pBuf);
sClient = WSASocket(AF_INETSOCK_STREAMIPPROTO_IPNULL0SOCK_STREAM);
if (sClient == INVALID_SOCKET)
return 1;
nZero = 0;
setsockopt(sClientSOL_SOCKETSO_RCVBUF(char *)&nZerosizeof(nZero));
server.sin_family = AF_INET;
server.sin_port = htons(port);
server.sin_addr.s_addr = inet_addr(szIP);
if (connect(sClient(struct sockaddr *)&serversizeof(server)) == SOCKET_ERROR)
{
me
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 52 2000-03-09 16:14 VCRemoteControl_Client_And_Server\RemoteControlClient\afiedt.buf
文件 15081 2003-07-10 16:55 VCRemoteControl_Client_And_Server\RemoteControlClient\client.c
文件 688 2003-07-10 14:11 VCRemoteControl_Client_And_Server\RemoteControlClient\client.h
文件 5497 2000-05-01 08:46 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.001
文件 5803 2003-07-09 17:45 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.dsp
文件 547 2000-05-01 13:04 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.dsw
文件 7290 2000-01-18 09:19 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.mak
文件 254976 2008-04-16 12:36 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.ncb
文件 60928 2008-04-16 12:36 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.opt
文件 1975 2003-07-10 19:49 VCRemoteControl_Client_And_Server\RemoteControlClient\ClientWindow.plg
文件 781 2003-07-10 15:45 VCRemoteControl_Client_And_Server\RemoteControlClient\ColorMode.cpp
文件 391 2003-07-10 15:46 VCRemoteControl_Client_And_Server\RemoteControlClient\ColorMode.h
文件 600 2003-07-10 15:47 VCRemoteControl_Client_And_Server\RemoteControlClient\Command.c
文件 350 2003-07-10 15:45 VCRemoteControl_Client_And_Server\RemoteControlClient\Command.h
文件 1709 2003-07-11 13:26 VCRemoteControl_Client_And_Server\RemoteControlClient\Compression.cpp
文件 389 2003-07-10 15:46 VCRemoteControl_Client_And_Server\RemoteControlClient\Compression.h
文件 1007 2003-07-10 15:47 VCRemoteControl_Client_And_Server\RemoteControlClient\Gdi.c
文件 498 2003-07-10 15:46 VCRemoteControl_Client_And_Server\RemoteControlClient\Gdi.h
文件 1596 2003-07-10 15:50 VCRemoteControl_Client_And_Server\RemoteControlClient\GridSpacing.cpp
文件 537 2003-07-10 15:48 VCRemoteControl_Client_And_Server\RemoteControlClient\GridSpacing.h
文件 23839 2003-07-10 15:52 VCRemoteControl_Client_And_Server\RemoteControlClient\HuffCompress.c
文件 958 2003-07-10 15:50 VCRemoteControl_Client_And_Server\RemoteControlClient\HuffCompress.h
文件 468 2000-01-21 12:57 VCRemoteControl_Client_And_Server\RemoteControlClient\IDB_NORECEIVE.BMP
文件 468 2000-01-21 12:57 VCRemoteControl_Client_And_Server\RemoteControlClient\IDB_NOSEND.BMP
文件 468 2000-01-21 12:57 VCRemoteControl_Client_And_Server\RemoteControlClient\IDB_RECEIVE.BMP
文件 468 2000-01-21 12:57 VCRemoteControl_Client_And_Server\RemoteControlClient\IDB_SEND.BMP
文件 17193 2003-07-10 16:41 VCRemoteControl_Client_And_Server\RemoteControlClient\MainWnd.cpp
文件 1956 2003-07-10 15:52 VCRemoteControl_Client_And_Server\RemoteControlClient\MainWnd.h
文件 1078 2003-07-09 17:27 VCRemoteControl_Client_And_Server\RemoteControlClient\Myfr
文件 2013 2003-07-09 17:27 VCRemoteControl_Client_And_Server\RemoteControlClient\resource.h
............此处省略50个文件信息
- 上一篇:c语言程序设计题总结资源
- 下一篇:c语言科学与艺术实训答案
评论
共有 条评论