www.pudn.com > 3.rar > Msg.cpp


// Msg.cpp: implementation of the CMsg class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "ChatClient.h" 
#include "Msg.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
IMPLEMENT_DYNCREATE(CMsg, CObject) 
CMsg::CMsg() 
{ 
	Init(); 
} 
 
CMsg::~CMsg() 
{ 
 
} 
 
void CMsg::Init() 
{ 
	code = 0; 
	m_bClose = FALSE; 
	m_strText = _T(""); 
} 
 
void CMsg::Serialize(CArchive& ar) 
{ 
	//¶ΑΘλ 
	if (ar.IsStoring()) 
	{ 
		ar << (WORD)m_bClose; 
		ar << m_strText; 
		ar << code; 
	} 
	//Κδ³φ 
	else 
	{ 
		WORD wd; 
		ar >> wd; 
		m_bClose = (BOOL)wd; 
		ar >> m_strText; 
		ar >> (UINT)code; 
	} 
}