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

📄 test2view.cpp

📁 这个是我现在在做组态软件开发用到的OPC源码
💻 CPP
字号:
// test2View.cpp : implementation of the CTest2View class
//

#include "stdafx.h"
#include "test2.h"
#include "DSDIALOG.h"
#include "test2Doc.h"
#include "test2View.h"
#include "server.h"
#include "group.h"
#include "item.h"

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

static LPCTSTR lpszPaths = _T("Paths");
static LPCTSTR lpszOpenFile = _T("Open File");
static LPCTSTR lpszCSV = _T("csv");
/////////////////////////////////////////////////////////////////////////////
// CTest2View

IMPLEMENT_DYNCREATE(CTest2View, CView)

BEGIN_MESSAGE_MAP(CTest2View, CView)
	//{{AFX_MSG_MAP(CTest2View)
	ON_COMMAND(ID_EDIT_NEWSERVER, OnNewserver)
	ON_COMMAND(ID_EDIT_NEWGROUP, OnNewgroup)
	ON_COMMAND(ID_EDIT_NEWITEM, OnNewitem)
	ON_COMMAND(ID_SHOWVALUE, OnShowvalue)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTest2View construction/destruction

CTest2View::CTest2View()
{
	// TODO: add construction code here

}

CTest2View::~CTest2View()
{
}

BOOL CTest2View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTest2View drawing

void CTest2View::OnDraw(CDC* pDC)
{
	CTest2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CTest2View printing

BOOL CTest2View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTest2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CTest2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CTest2View diagnostics

#ifdef _DEBUG
void CTest2View::AssertValid() const
{
	CView::AssertValid();
}

void CTest2View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CTest2Doc* CTest2View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTest2Doc)));
	return (CTest2Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTest2View message handlers

void CTest2View::OnNewserver() 
{
	CTest2Doc *pDoc = (CTest2Doc *) GetDocument ();

	// If poiner looks good, tell document to add a server:
	if (pDoc)
		pDoc->AddServer ();	
}

void CTest2View::OnNewgroup() 
{
	CTest2Doc *pDoc = (CTest2Doc *) GetDocument ();

	// If pointer looks good, tell document to add a group:
	if (pDoc)
		pDoc->AddGroup ();
	
}

void CTest2View::OnNewitem() 
{
CTest2Doc *pDoc = (CTest2Doc *) GetDocument ();

	// Tell document to add a new item:
	if (pDoc)
		pDoc->AddItem ();	
}

void CTest2View::OnShowvalue() 
{
	CDSDIALOG ds;
	ds.DoModal();
	
}

⌨️ 快捷键说明

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