⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paremessage.cpp

📁 qq聊天的一些基本功能,要的太飞 飞师大~
💻 CPP
字号:
#include "Stdafx.h"
#include "ParseMessage.h"
#include "ChatClient.h"
#include "ClientFormView.h"
#include "ConnectServerDlg.h"
#include "MainFrm.h"
CParseMessage::~CParseMessage()
{
}
CParseMessage::CParseMessage(const CMyTreeView * pWnd,const Message & Value)
{
	pView = const_cast < CMyTreeView *>(pWnd);
	Msg = Value;
}
extern CChatClientApp theApp;
BOOL CParseMessage::SWitchMessage()
{
	ASSERT(pView != NULL);
	ASSERT_VALID(pView);
	CClientFormView * m_pFormView =(CClientFormView *) ((CMainFrame * )AfxGetMainWnd())->GetFormView();
	int iTryTimes = 0;
	switch(Msg.iType)
	{
	case USERLOG:
		switch(Msg.iSubType)
		{
		case ROOMLIST:
		//	pView ->PostMessage(WM_ADDNEWROOM,WPARAM(&Msg),0);
			pView ->AddNewRoom(Msg,0);
		
			break;
		case  USERLIST:
		case USERLOGIN:
			//pView ->PostMessage(WM_NEWCLIENTCOMEIN,WPARAM(&Msg),0);
			pView ->OnNewClientIn(Msg,0);
			break;
	
		case  USERLOGOUT:
		//	pView ->PostMessage(WM_USERLOGOUT,WPARAM(&Msg),0);
			pView ->OnClientOut(Msg,0);
			break;
		default:
			break;
		}
		break;
		case USERSESSION:
			
			switch( Msg.iSubType)
			{
			case SAYINPRIVATE:
			//	pView ->PostMessage(WM_SAYINPRIVATE,WPARAM(&Msg),0);
				pView ->OnSayInPrivate(Msg,0);
				break;
		
				
			default:
				break;
			}
			break;
			
			case SYSERROR :
				
				switch(Msg.iSubType)
				{
				case  SERVERQUIT:
					AfxMessageBox("服务器关闭");
					AfxGetMainWnd()->PostMessage(WM_QUIT,0);
					break;
				case USEREXSIT:
					{
						AfxMessageBox("用户名已经存在");
						theApp.m_skMainSocket.SetState(NOTLOGIN);
						CString strServerIp;
						int iServerPort;
						if(!theApp.IniFile.GetVarStr("SERVERIP","DEFUALTSERVERIP",strServerIp))
						{
							strServerIp = _T("127.0.0.1");
						}
						if(!theApp.IniFile.GetVarInt("SERVERPORT","DEFAULTSERVERPORT",iServerPort))
						{
							iServerPort = 1080;
						}
						CConnectServerDlg Dlg(theApp.m_skMainSocket.GetUserName(),strServerIp,iServerPort);
						
						if(Dlg.DoModal() == IDCANCEL)
						{
							AfxGetMainWnd()->PostMessage(WM_QUIT);
							break;
						}
						Message msObj;
						msObj.iType = FIRSTLOG;
						msObj.iSubType = NOTFIRSTTIME;
						CString strTemp = Dlg.m_strUserName;
						int iLen = strTemp.GetLength();
						lstrcpy(msObj.strName,_T(strTemp.GetBuffer(iLen)));
						strTemp.ReleaseBuffer();
						theApp.m_skMainSocket.Send(&msObj,sizeof(Message));
						theApp.m_skMainSocket.SetUserName(strTemp);
					}
					break;
				default:
					break;
				}
				break;
	
		default:
			break;
	}
	return TRUE;

}

⌨️ 快捷键说明

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