mainsocket.cpp

来自「QQ示例源码」· C++ 代码 · 共 68 行

CPP
68
字号
// MainSocket.cpp : implementation file
//

#include "stdafx.h"
#include "ChatClient.h"
#include "MainSocket.h"
#include "MainFrm.h"


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

/////////////////////////////////////////////////////////////////////////////
// CMainSocket

CMainSocket::CMainSocket():iState(NOTLOGIN)
{
	bMessage = FALSE;
}

CMainSocket::~CMainSocket()
{
}


// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CMainSocket, CSocket)
	//{{AFX_MSG_MAP(CMainSocket)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif	// 0

/////////////////////////////////////////////////////////////////////////////
// CMainSocket member functions

void CMainSocket::OnReceive(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	CMainFrame * pFrame = static_cast <CMainFrame *>(AfxGetMainWnd());
	CMyTreeView * pTreeView = pFrame->GetTreeView();
	Message msContent;
	int iLen1 = sizeof(msContent);	int iLen2 = sizeof(Message);
	memset(&msContent,0,sizeof(msContent));
	int iLen = Receive(&msContent,sizeof(msContent));


	CParseMessage Parse(pTreeView,msContent);
	Parse.SWitchMessage();
	


	CSocket::OnReceive(nErrorCode);
	
}
void CMainSocket::SetState(int state)
{
	if(state == NOTLOGIN || state == HAVELOGIN)
		iState = state;
}
int CMainSocket::GetState()
{	
	return iState;
}

⌨️ 快捷键说明

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