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

📄 falcon_jxcdoc.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// FALCON_JXCDoc.cpp : implementation of the CFALCON_JXCDoc class
//


#include "stdafx.h"
#include "FALCON_JXC.h"

#include "FALCON_JXCDoc.h"
#include "SrvrItem.h"
#include "ServiceSocket.h"
#include "Message.h"
#include "Serveraddressandportsetting.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc

IMPLEMENT_DYNCREATE(CFALCON_JXCDoc, COleServerDoc)

BEGIN_MESSAGE_MAP(CFALCON_JXCDoc, COleServerDoc)
	//{{AFX_MSG_MAP(CFALCON_JXCDoc)
	ON_COMMAND(ID_ServerAddressAndPort, OnServerAddressAndPort)
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
	ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc construction/destruction

CFALCON_JXCDoc::CFALCON_JXCDoc()
{
	// Use OLE compound files
//	m_sQuanXianArray.
	m_pImage = new CImage;
//	m_nCode = 0;
	EnableCompoundFile();
	m_strAddress = _T("127.0.0.1");
	m_nPort = 8888;
	// TODO: add one-time construction code here
	m_bOnline = FALSE;
	m_pMsg = new CMessage();
	Name=GetHostAddress();

	m_b13201=FALSE;
	m_b2320 = FALSE;
	m_b2321 = FALSE;
	m_b2322 = FALSE;
	m_b13221 = FALSE;
	m_b23111=FALSE;
	m_b2323=FALSE;
	m_b23101 = FALSE;
	m_b2331 = FALSE;
	m_b2211 = FALSE;
	m_b2212 = FALSE;
	m_b2220 = FALSE;
	m_b2221 = FALSE;
	m_b2910 = FALSE;
	m_b2912 = FALSE;
	m_b2913 = FALSE;
	m_b2914 = FALSE;
	m_b2920 = FALSE;
	m_b2922 = FALSE;
	m_b2223 = FALSE;
	m_b2311 = FALSE;
	m_b2312 = FALSE;
	m_b2313 = FALSE;
	m_b2340 = FALSE;
	m_b2230 = FALSE;
	m_b2231 = FALSE;
	m_b2510 = FALSE;
	m_b2511 = FALSE;
	m_b2512 = FALSE;
	m_b2513 = FALSE;
	m_b2514 = FALSE;
	m_b2515 = FALSE;
	m_b2516 = FALSE;
	m_b2517 = FALSE;
	m_b2518 = FALSE;
	m_b2519 = FALSE;
	m_b2315 = FALSE;
	m_b2233 = FALSE;
	m_b2350 = FALSE;
	m_b2810 = FALSE;
	m_b2811=FALSE;
	m_b2812=false;
    m_b2813=false;
    m_b2814=false;
	m_b2110=FALSE;
	m_b2111=FALSE;
	m_b2120 = FALSE;
	m_b2410 = FALSE;
	m_b2222 = FALSE;
	m_b2232 = FALSE;
	m_pSocket=NULL;
	m_iRow = 0;
	m_iCol = 0;
	m_strComm = _T("");
	for(int i=0;i<50;i++)
	{
		m_sQuanXianArray[i]="0";
	}
}

CFALCON_JXCDoc::~CFALCON_JXCDoc()
{	
	if(!m_pSocket)
	{
		delete m_pSocket;
		m_pSocket = NULL;
	}
	if (m_pMsg != NULL)
		delete m_pMsg;

	if (m_StrArray.GetSize()!=0)
		m_StrArray.RemoveAll();
//	if (m_sQuanXianArray.GetSize()!=0)
//		m_sQuanXianArray.RemoveAll();
	delete m_pImage;
}

BOOL CFALCON_JXCDoc::OnNewDocument()
{
	if (!COleServerDoc::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc server implementation

COleServerItem* CFALCON_JXCDoc::OnGetEmbeddedItem()
{
	// OnGetEmbeddedItem is called by the framework to get the COleServerItem
	//  that is associated with the document.  It is only called when necessary.

	CFALCON_JXCSrvrItem* pItem = new CFALCON_JXCSrvrItem(this);
	ASSERT_VALID(pItem);
	return pItem;
}



/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc serialization

void CFALCON_JXCDoc::Serialize(CArchive& ar)
{
	m_pImage->Serialize(ar);
	if (ar.IsStoring())
	{
		// TODO: add storing code here
//		ar<<m_nCode;
	}
	else
	{
		// TODO: add loading code here
//		ar>>m_nCode;
	}
}

/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc diagnostics

#ifdef _DEBUG
void CFALCON_JXCDoc::AssertValid() const
{
	COleServerDoc::AssertValid();
}

void CFALCON_JXCDoc::Dump(CDumpContext& dc) const
{
	COleServerDoc::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFALCON_JXCDoc commands
void CFALCON_JXCDoc::ProcessReadMessage()
{
	do
	{
		ReceiveMsg();
		if (m_pSocket == NULL)
			return;
	}
	while(!m_pSocket->m_pArchiveIn->IsBufferEmpty());
	
}
void CFALCON_JXCDoc::ReceiveMsg()
{
	
	m_pMsg->Serialize(*m_pSocket->m_pArchiveIn);

	switch(m_pMsg->Type)
	{
	case 23201:
		m_b13201=true;
		break;
	case 2321:
		m_b2321 = TRUE;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,41);
		break;
	case 23221:
		m_b13221=true;
		break;
	case 23111:
		m_b23111=true;
		break;
	case 2323:
		m_b2323=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,45);
		break;
	case 23101:
		m_b23101=true;
		break;
	case 2331:
		m_b2331=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,4);
		break;
	case 2211:
		m_b2211=true;
		break;
	case 2212:
		m_b2212=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2220:
		m_b2220=true;
		break;
	case 2221:
		m_b2221=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2910:
		m_b2910=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2912:
		m_b2912=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
/*	case 2913:
		m_b2913=true;
		StringSeg(m_pMsg->ShortMessage);
		break;
*/	
	case 2914:
		m_b2914=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2920:
		m_b2920=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2922:
		m_b2922=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2223:
		m_b2223=true;
		break;
	case 2312:
		m_b2312=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2313:
		m_b2313=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,24);
		break;
	case 2340:
		m_b2340=true;
		break;
	case 2230:
		m_b2230=true;
		break;
	case 2231:
		m_b2231=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,30);
		break;
	case 2233:
		m_b2233=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,24);
		break;
	case 2510:
		m_b2510=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2511:
		m_b2511=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2512:
		m_b2512=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2513:
		m_b2513=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2514:
		m_b2514=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2515:
		m_b2515=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2516:
		m_b2516=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2517:
		m_b2517=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
	case 2518:
		m_b2518=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2519:
		m_b2519=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2315:
		m_b2315=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage,7);
		break;
	case 2350:
		m_b2350=true;
		if(m_pMsg->ShortMessage != "")
			StringSeg(m_pMsg->ShortMessage);
		break;
	case 2320:
		AfxMessageBox("存储成功!");
		m_b2320 = TRUE;
		break;
	case 2232:
		m_b2232=TRUE;
		AfxMessageBox("存储成功!");
		break;
	case 2341:
		AfxMessageBox("存储成功!");
		break;
	case 2913:
		AfxMessageBox("成功删除!");
		break;
	case 2911:
		AfxMessageBox("存储成功!");
		break;
	case 2915:
		AfxMessageBox("存储成功!");
		break;
	case 2311:
		AfxMessageBox("存储成功!");
		m_b2311 = TRUE;
		break;
	case 2322:
		AfxMessageBox("存储成功!");
		m_b2322 = TRUE;
		break;

⌨️ 快捷键说明

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