msg.cpp

来自「基于winsock的聊天程序」· C++ 代码 · 共 75 行

CPP
75
字号
// Msg.cpp: implementation of the CMsg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ChatServer.h"
#include "Msg.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMsg::CMsg()
{
	m_dImage = 6;
	m_nType =-1;
	m_bSecret = FALSE;
	m_color = RGB(0,136,255);
	m_bClose = FALSE;
	m_strFrom = m_strTo = m_strText = _T("");
}

CMsg::~CMsg()
{

}

void CMsg::Serialize(CArchive &ar)
{
	if (ar.IsStoring()){
		ar << m_nType;
		ar << (WORD)m_bClose;
		ar << m_strText;
		ar << (WORD)m_bSecret;
		ar << m_strFrom;
		ar << m_strTo;
		ar << (DWORD)m_color;
		ar << m_dImage;
	}
	else{
		WORD wd;
		DWORD dwTmp;

		ar >> m_nType;
		ar >> wd;
		m_bClose = (BOOL)wd;
		ar >> m_strText;
		ar >> wd;
		m_bSecret = (BOOL)wd;
		ar >> m_strFrom;
		ar >> m_strTo;
		ar >> dwTmp;
		m_color = (COLORREF)dwTmp;
		ar >> m_dImage;
	}
}

void CMsg::Reset()
{
	m_dImage = 6;
	m_nType =-1;
	m_bSecret = FALSE;
	m_color = RGB(0,136,255);
	m_bClose = FALSE;
	m_strFrom = m_strTo = m_strText = _T("");

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?