MainSocket.cpp
资源名称:QQ示例源码.rar [点击查看]
上传用户:power_led
上传日期:2013-04-11
资源大小:373k
文件大小:1k
源码类别:
ICQ/即时通讯
开发平台:
Visual C++
- // 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;
- }