www.pudn.com > seedesk.zip > EmployerSocket.cpp


// EmployerSocket.cpp : implementation file 
// 
/*************************************************************************** 
 *        Module               :                             * 
 *         
 *                                                                         * 
 *        Created by           : ??      Date  : 2004.9.12         * 
 *        Modified by          :                  Date  :                  * 
 *                                                                         *  
 *                   *  
 ***************************************************************************/ 
 
#include "stdafx.h" 
#include "EmployerSever.h" 
#include "EmployerSocket.h" 
#include "EmployerSeverDlg.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CEmployerSocket 
 
CEmployerSocket::CEmployerSocket(CEmployerSeverDlg *pDlg) 
{ 
  m_pDlg=pDlg; 
} 
 
CEmployerSocket::~CEmployerSocket() 
{ 
	if(m_pDlg!=NULL) 
		m_pDlg=NULL; 
} 
 
 
// Do not edit the following lines, which are needed by ClassWizard. 
#if 0 
BEGIN_MESSAGE_MAP(CEmployerSocket, CSocket) 
	//{{AFX_MSG_MAP(CEmployerSocket) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
#endif	// 0 
 
///////////////////////////////////////////////////////////////////////////// 
// CEmployerSocket member functions 
 
void CEmployerSocket::OnReceive(int nErrorCode)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	 
	CSocket::OnReceive(nErrorCode); 
	 
	char MsgType[30]; 
	int rec=Receive(MsgType,30,0); 
	MsgType[rec-1]='\0'; 
		switch(*MsgType)  
		{ 
           case 'B': 
			   {  
				   m_pDlg->SendBITMAP(this); //接收类型为b  
				                             //发送bitmap结构 
			   }break; 
           case 'D': 
               {m_pDlg->SendBitData(this);//发送bitmap的数据 
			   }break; 
		   default: 
			   { 
				   CString str=MsgType; 
				   AfxMessageBox(str);//显示boss发过来的消息 
			   } 
		} 
         
 
}