📄 mainsocket.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -