📄 msg.cpp
字号:
// msg.cpp : implementation of the CMsg class
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "msg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMsg
IMPLEMENT_DYNCREATE(CMsg, CObject)
/////////////////////////////////////////////////////////////////////////////
// CMsg construction/destruction
CMsg::CMsg()
{
Init();
}
CMsg::~CMsg()
{
}
/////////////////////////////////////////////////////////////////////////////
// CMsg Operations
void CMsg::Init()
{
m_wCmd = CMD_SOCKET_WAIT;
m_rcArea = CRect(0,0,100,100);
m_nBits = 8;
m_lpFileData = NULL;
m_lpBmpData = NULL;
m_dwBmpSize = 0;
m_dwBmpInfoSize = 0;
m_dwFileSize = 0;
m_bError = FALSE;
m_strText = _T("");
m_strPassword = _T("");
}
/////////////////////////////////////////////////////////////////////////////
// CMsg serialization
void CMsg::Serialize(CArchive& ar)
{
HANDLE hMem;
if (ar.IsStoring())
{
switch (m_wCmd)
{
case CMD_GET_SCREEN :
ar << (WORD)m_wCmd;
ar << m_dwBmpInfoSize;
ar << m_dwBmpSize;
ar << m_dwFileSize;
ar << m_bCompress;
if (m_dwBmpSize > 0 && m_lpBmpData != NULL)
ar.Write (m_lpBmpData,m_dwBmpSize);
/*
int iSize;
iSize = -1;
if (m_bCompress == TRUE) {
hMem = GlobalAlloc (GHND,m_dwBmpSize);
m_lpFileData = (LPSTR)GlobalLock (hMem);
iSize = m_Encode.ntEncode((char *)m_lpFileData, (char *)m_lpBmpData, m_dwBmpSize);
// m_Decode.ntDecode((char *)m_lpBmpData, (char *)m_lpFileData);
}
if (iSize > 0 )
{
ar << (WORD)m_wCmd;
ar << m_dwBmpInfoSize;
ar << m_dwBmpSize;
ar << m_dwFileSize;
ar << m_bCompress;
ar.Write (m_lpFileData,iSize);
GlobalUnlock(m_lpFileData);
GlobalFree(m_lpFileData);
}
else
{
m_bCompress = FALSE;
ar << (WORD)m_wCmd;
ar << m_dwBmpInfoSize;
ar << m_dwBmpSize;
ar << 0;
ar << m_bCompress;
ar.Write (m_lpBmpData,m_dwBmpSize);
}
*/
break;
case CMD_GET_SCREEN_INFO:
ar << (WORD)m_wCmd;
ar << m_nBits;
ar << m_rcArea;
break;
case CMD_FILE_RECEIVE:
ar << (WORD)m_wCmd;
ar << m_dwFileSize;
ar.Write (m_lpFileData, m_dwFileSize);
break;
case CMD_STATE_INFO:
ar << m_wCmd;
ar << m_strText;
break;
case CMD_SOCKET_CLOSE:
ar << m_wCmd;
ar << m_strText;
break;
}//end switch
}
else
{
WORD wd;
ar >> wd;
m_wCmd = wd;
ar >> m_strPassword;
switch (m_wCmd)
{
case CMD_GET_SCREEN:
ar >> m_rcArea;
ar >> m_nBits;
ar >> m_bCompress;
break;
case CMD_SOCKET_CLOSE:
case CMD_STATE_INFO:
ar >> m_strText;
break;
case CMD_FILE_SEND:
ar >> m_strParam;
ar >> m_dwFileSize;
m_lpFileData = GlobalAlloc (GMEM_FIXED,m_dwFileSize);
ar.Read (m_lpFileData,m_dwFileSize);
break;
case CMD_KEY_MOUSE_BUFFER:
ar >> m_iSendPoint;
ar.Read(m_vsSendKey, m_iSendPoint * sizeof(SENDKEY));
break;
case CMD_KEY_HOOK:
case CMD_MOUSE_HOOK:
ar >> m_dwHookFlags;
ar >> m_dwHookParam1;
ar >> m_dwHookParam2;
break;
default:
ar >> m_strParam;
}//end switch
} //end if
}
/////////////////////////////////////////////////////////////////////////////
// CMsg diagnostics
#ifdef _DEBUG
void CMsg::AssertValid() const
{
CObject::AssertValid();
}
void CMsg::Dump(CDumpContext& dc) const
{
CObject::Dump(dc);
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -