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

📄 infoserverexplorerdoc.cpp

📁 此为Insight opc client InfoServerExplorer源程序
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
//
//  OPC DataAccess VC++ Client:	InfoServerExplorerDoc.CPP
//								(Source File)
//
/////////////////////////////////////////////////////////////////////////////
//
//          Author: Raphael Imhof
//    Initial Date: 11/04/98
//       $Workfile: InfoServerExplorerDoc.cpp $
//       $Revision: 1 $
//           $Date: 7/27/99 5:23p $
//   Target System: Microsoft Windows NT 4.0
//     Environment: Visual C++ 5.0 / OPC DataAccess 1.0/2.0
//         Remarks: 
//
/////////////////////////////////////////////////////////////////////////////
//
//     Description: implementation of the CInfoServerExplorerDoc class
//					
//
/////////////////////////////////////////////////////////////////////////////
//
//  History of Changes     (Please remove very old comments and blank lines!)
//            $Log: /IDK/OPCServer/clients/VC++/InfoServerExplorer/InfoServerExplorerDoc.cpp $
// 
// 1     7/27/99 5:23p Imhof
// 
// 1     7/27/99 5:18p Imhof
// 
// 6     1/15/99 6:43p Imhof
// Updated legal notice.
// 
// 5     11/10/98 2:20p Imhof
// Added file header's.
// 
// 
//  $Nokeywords:$ (To avoid useless search while checking in.)
/////////////////////////////////////////////////////////////////////////////
//  Copyright (C) 1998, Siemens Building Technologies, Inc. Landis Division
//
// SIEMENS BUILDING TECHNOLOGIES, INC. IS PROVIDING THE FOLLOWING
// EXAMPLES OF CODE AS SAMPLE ONLY.
//
// SIEMENS BUILDING TECHNOLOGIES, INC.  MAKES NO REPRESENTATIONS
// OR WARRANTIES OF ANY KIND  WITH RESPECT TO THE VALIDTY OF THE 
// CODES   OR   DESIRED   RESULTS   AND   DISCLAIMS   ALL   SUCH 
// REPRESENTATIONS   AND   WARRANTIES,  INCLUDING  FOR  EXAMPLE, 
// WARRANTIES  OF  MERCHANTABILITY  AND FITNESS FOR A PARTICULAR 
// PURPOSE.    SIEMENS  BUILIDNG  TECHNOLOGIES,  INC.  DOES  NOT 
// REPRESENT  OR  WARRANT  THAT  THE  FOLLOWING CODE SAMPLES ARE 
// ACCURATE, VALID, COMPLETE OR CURRENT.
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "InfoServerExplorer.h"
#include "InfoServerExplorerDoc.h"
#include "MainFrm.h"


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

/////////////////////////////////////////////////////////////////////////////
// CInfoServerExplorerDoc

IMPLEMENT_DYNCREATE(CInfoServerExplorerDoc, CDocument)

BEGIN_MESSAGE_MAP(CInfoServerExplorerDoc, CDocument)
	//{{AFX_MSG_MAP(CInfoServerExplorerDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInfoServerExplorerDoc construction/destruction

CInfoServerExplorerDoc::CInfoServerExplorerDoc()
{
	// TODO: add one-time construction code here
	m_pInfoServer = NULL;

	m_pInfoServer = new CInfoServer;

}

CInfoServerExplorerDoc::~CInfoServerExplorerDoc()
{
	
}

BOOL CInfoServerExplorerDoc::OnNewDocument()
{
	//remove existing groups and items first
	
	if(m_pInfoServer != NULL)
	{
		//file new must do first a disconnect
		if(m_pInfoServer->IsConnected()) 
		{
			m_pInfoServer->Disconnect();

			//delete all items !
			UpdateAllViews(NULL, 0, NULL);
		}
	}

	if (!CDocument::OnNewDocument())
		return FALSE;

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

	return TRUE;
}

BOOL CInfoServerExplorerDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	//remove existing groups and items first
	
	if(m_pInfoServer->IsConnected())
	{
		m_pInfoServer->Disconnect();
		
		//delete all items !
		UpdateAllViews(NULL, 0, NULL);
	}

	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	// TODO: Add your specialized creation code here

	if(m_pInfoServer->Connect())
		m_pInfoServer->RecreateOnServer();

	return TRUE;
}

void CInfoServerExplorerDoc::OnCloseDocument() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	//called only on app close (SDI)

	m_pInfoServer->Disconnect();
	delete m_pInfoServer;
	m_pInfoServer = NULL;

	CDocument::OnCloseDocument();
}

/////////////////////////////////////////////////////////////////////////////
// CInfoServerExplorerDoc serialization

void CInfoServerExplorerDoc::Serialize(CArchive& ar)
{
	m_pInfoServer->Serialize(ar);	
}

/////////////////////////////////////////////////////////////////////////////
// CInfoServerExplorerDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CInfoServerExplorerDoc commands

CInfoServer* CInfoServerExplorerDoc::GetInfoServer()
{
	return m_pInfoServer;
}

⌨️ 快捷键说明

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