readitemdlg.cpp

来自「此为Insight opc client InfoServerExplorer源」· C++ 代码 · 共 161 行

CPP
161
字号
/////////////////////////////////////////////////////////////////////////////
//
//  OPC DataAccess VC++ Client:	ReadItemDlg.CPP
//								(Source File)
//
/////////////////////////////////////////////////////////////////////////////
//
//          Author: Raphael Imhof
//    Initial Date: 11/04/98
//       $Workfile: ReadItemDlg.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 CReadItemDlg class.
//					Read dialog with options.
//					
//
/////////////////////////////////////////////////////////////////////////////
//
//  History of Changes     (Please remove very old comments and blank lines!)
//            $Log: /IDK/OPCServer/clients/VC++/InfoServerExplorer/ReadItemDlg.cpp $
// 
// 1     7/27/99 5:23p Imhof
// 
// 1     7/27/99 5:19p Imhof
// 
// 6     2/05/99 5:07p Imhof
// Fixed wrong selections for OPC 1.0/2.0.
// 
// 5     1/15/99 6:43p Imhof
// Updated legal notice.
// 
// 4     12/11/98 5:58p Imhof
// Made modifications for OPC 2.0.
// 
// 3     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 "MainFrm.h"
#include "infoserverexplorerdoc.h"
#include "ReadItemDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CReadItemDlg dialog


CReadItemDlg::CReadItemDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReadItemDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReadItemDlg)
	m_iFrom = 0; //cache
	m_iRead = 0; //sync
	//}}AFX_DATA_INIT
}


void CReadItemDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReadItemDlg)
	DDX_Radio(pDX, IDC_READ_CACHE, m_iFrom);
	DDX_Radio(pDX, IDC_READ_SYNC, m_iRead);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReadItemDlg, CDialog)
	//{{AFX_MSG_MAP(CReadItemDlg)
	ON_BN_CLICKED(IDC_READ_ASYNC, OnReadAsync)
	ON_BN_CLICKED(IDC_READ_SYNC, OnReadSync)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReadItemDlg message handlers

/*
	async cache read only for OPC 1.0
*/

void CReadItemDlg::OnReadAsync() 
{
	// TODO: Add your control notification handler code here
	CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd();
	CInfoServerExplorerDoc*	pDoc = (CInfoServerExplorerDoc*) pMainFrame->GetActiveDocument();
	
	m_iRead = 1;

	if(pDoc->GetInfoServer()->GetOPCVersion() > OPC_VERSION_10) //OPC 1.0
	{
		GetDlgItem(IDC_FROM_STATIC)->EnableWindow(FALSE);	
		GetDlgItem(IDC_READ_CACHE)->EnableWindow(FALSE);
		GetDlgItem(IDC_READ_DEVICE)->EnableWindow(FALSE);
		m_iFrom = 1; //device
		UpdateData(FALSE); //mark device
	}
	else
	{
		GetDlgItem(IDC_FROM_STATIC)->EnableWindow(TRUE);	
		GetDlgItem(IDC_READ_CACHE)->EnableWindow(TRUE);
		GetDlgItem(IDC_READ_DEVICE)->EnableWindow(TRUE);	
	}
	
}

void CReadItemDlg::OnReadSync() 
{
	// TODO: Add your control notification handler code here
	m_iRead = 0;

	GetDlgItem(IDC_FROM_STATIC)->EnableWindow(TRUE);	
	GetDlgItem(IDC_READ_CACHE)->EnableWindow(TRUE);
	GetDlgItem(IDC_READ_DEVICE)->EnableWindow(TRUE);
}

BOOL CReadItemDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if(m_iRead > 0) //async
		OnReadAsync();
	else //sync
		OnReadSync();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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