【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,AcceptSocket.cpp,希望对大家有所帮助!
// AcceptSocket.cpp : implementation file
//
#include "stdafx.h"
#include "DAOQry.h"
#include "AcceptSocket.h"
#include "AcceptSocket.h"
#include "MainFrm.h"
#include "MyRecords.h"
#include "DAOQryDoc.h"
#include "DAOListView.h"
#include "MyFieldInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAcceptSocket
CAcceptSocket::CAcceptSocket(CDAOQryDoc *pDAOQryDoc)
{
m_pDAOQryDoc=pDAOQryDoc;
}
CAcceptSocket::~CAcceptSocket()
{
delete m_pServerSocketFile;
delete m_pServerArIn;
delete m_pServerArOut;
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CAcceptSocket, CSocket)
//{{AFX_MSG_MAP(CAcceptSocket)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
/////////////////////////////////////////////////////////////////////////////
// CAcceptSocket member functions
void CAcceptSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
m_pServerSocketFile=new CSocketFile((CSocket*)this,TRUE);
m_pServerArIn=new CArchive(m_pServerSocketFile,CArchive::load);
m_pServerArOut=new CArchive(m_pServerSocketFile,CArchive::store);//me
CMyRecords* myrs=new CMyRecords;
myrs->Serialize(*m_pServerArIn);
CMyFieldInfo fi=myrs->m_FieldAry.GetAt(0);
// CString q=myrs->m_FieldAry.GetAt(0).m_strName;
// AfxMessageBox(q,MB_OK);
m_pDAOQryDoc->m_pListView->EraseList();
CListCtrlEx& ctlList = (CListCtrlEx&) m_pDAOQryDoc->m_pListView->GetListCtrl();
myrs->ShowInList(ctlList);
m_pDAOQryDoc->m_pListView->UpdateWindow();
CSocket::OnReceive(nErrorCode);
}