datashowdoc.cpp

来自「CAN__组建现场总线系统设计技术(光盘)」· C++ 代码 · 共 99 行

CPP
99
字号
// DataShowDoc.cpp : implementation file
//

#include "stdafx.h"
#include "VCStyle.h"
#include "DataShowDoc.h"

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

#include "data.h"
#include "DataShowView.h"
/////////////////////////////////////////////////////////////////////////////
// CDataShowDoc

IMPLEMENT_DYNCREATE(CDataShowDoc, CDocument)

CDataShowDoc::CDataShowDoc()
{
	m_addr = 255;
	m_ch = 255;
}

BOOL CDataShowDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;
	return TRUE;
}

CDataShowDoc::~CDataShowDoc()
{
}


BEGIN_MESSAGE_MAP(CDataShowDoc, CDocument)
	//{{AFX_MSG_MAP(CDataShowDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDataShowDoc diagnostics

#ifdef _DEBUG
void CDataShowDoc::AssertValid() const
{
	CDocument::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CDataShowDoc serialization

void CDataShowDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CDataShowDoc commands

BOOL CDataShowDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	UINT addr,ch;
	//lpszPathName格式:"模块地址,通道号"
	sscanf(lpszPathName,"%d,%d",&addr,&ch);

	m_addr = addr;
	m_ch = ch;

	if(m_addr>=MAX_MODELS ||
		m_ch >= MAX_CHANS){
		AfxMessageBox("数据通道错!");
		return FALSE;
	}
	
//	if (!CDocument::OnOpenDocument(NULL))
//		return FALSE;
	if (!CDocument::OnNewDocument())
		return FALSE;
	return TRUE;
}

⌨️ 快捷键说明

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