• 大小: 249KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-12
  • 语言: C/C++
  • 标签: C++  OPC  客户端  

资源简介

运用VC开发的OPC客户端

资源截图

代码片段和文件信息

//**************************************************************************
//
//  Copyright (c) FactorySoft INC. 1996-1998 All Rights Reserved
//
//**************************************************************************
//
//  Filename   :  ConnectionPoint.cpp
//  $Author    :  Jim Hansen
//
//  Description:  Callback class for OPC Data Access 2.0
//
//
//**************************************************************************
#include “stdafx.h“
#include “IAdvsink.h“
//#include “ConnectionPoint.h“

#include “OPCClientDoc.h“

CComModule _Module;  // just needed to keep ATL happy

extern OPCClientDoc* theDoc;

//**************************************************************************
// Called by the server at the update rate when data changes
STDMETHODIMP OPCCallback::OnDataChange(
       DWORD       Transid
       OPCHANDLE   grphandle
       HRESULT     masterquality
       HRESULT     mastererror
       DWORD       count
       OPCHANDLE * clienthandles
       VARIANT   * values
       WORD      * quality
       FILETIME  * time
       HRESULT   * errors)
{
// If Transid != 0 this is a refresh
for( DWORD index=0; index {
if( SUCCEEDED(errors[index]) )
{
Item* pItem = (Item*)clienthandles[index];
if( pItem )
{
pItem->value = values[index];
pItem->quality = quality[index];
pItem->timestamp = time[index];
}
}
}
PostMessage(theDoc->data_hwnd WM_DATACHANGE 0 0);
return S_OK;
}

//**************************************************************************
// Called by the server to complete an ASyncIO2::Read
STDMETHODIMP OPCCallback::OnReadComplete(
 DWORD       Transid
 OPCHANDLE   grphandle
 HRESULT     masterquality
 HRESULT     mastererror
 DWORD       count
 OPCHANDLE * clienthandles
 VARIANT   * values
 WORD      * quality
 FILETIME  * time
 HRESULT   * errors)
{
ASSERT( Transid == 3 ); // test only
for( DWORD index=0; index {
if( SUCCEEDED(errors[index]) )
{
Item* pItem = (Item*)clienthandles[index];
if( pItem )
{
pItem->value = values[index];
pItem->quality = quality[index];
pItem->timestamp = time[index];
}
}
}
PostMessage(theDoc->data_hwnd WM_DATACHANGE 0 0);
return S_OK;
}


//**************************************************************************
// Called by the server to complete an ASyncIO2::Write
STDMETHODIMP OPCCallback::OnWriteComplete(
  DWORD       Transid
  OPCHANDLE   grphandle
  HRESULT     mastererr
  DWORD       count
  OPCHANDLE * clienthandles
  HRESULT   * errors)
{
ASSERT( Transid == 2 ); // test only
for( DWORD index=0; index {
if( FAILED(errors[index]) )
{
Item* pItem = (Item*)clienthandles[index];
PostMessage(theDoc->data_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3645  2006-03-22 10:40  CUS_OPCClient\ConnectionPoint.cpp

     文件       2413  2005-01-14 14:28  CUS_OPCClient\ConnectionPoint.h

     文件      49224  2007-03-13 16:39  CUS_OPCClient\CUS_OPCClient.aps

     文件       7989  2007-03-30 16:20  CUS_OPCClient\CUS_OPCClient.clw

     文件       5314  2007-03-15 09:56  CUS_OPCClient\CUS_OPCClient.cpp

     文件       6562  2007-03-14 13:23  CUS_OPCClient\CUS_OPCClient.dsp

     文件        549  2006-03-21 10:00  CUS_OPCClient\CUS_OPCClient.dsw

     文件       1438  2006-03-22 21:38  CUS_OPCClient\CUS_OPCClient.h

     文件     304128  2007-03-30 16:20  CUS_OPCClient\CUS_OPCClient.ncb

     文件     286208  2007-03-30 16:20  CUS_OPCClient\CUS_OPCClient.opt

     文件       1460  2007-03-15 09:56  CUS_OPCClient\CUS_OPCClient.plg

     文件      21296  2006-04-10 08:55  CUS_OPCClient\CUS_OPCClient.rc

     文件       1582  2006-03-26 20:10  CUS_OPCClient\GroupDialog.cpp

     文件       1351  2006-03-26 20:10  CUS_OPCClient\GroupDialog.h

     文件       5636  2006-03-22 10:46  CUS_OPCClient\IAdvsink.CPP

     文件        723  2006-03-21 16:38  CUS_OPCClient\IAdvsink.h

     文件      13658  2006-04-21 10:44  CUS_OPCClient\ItemDialog.cpp

     文件       2165  2006-03-24 04:01  CUS_OPCClient\ItemDialog.h

     文件       1505  2006-03-26 23:19  CUS_OPCClient\ItemPropertiesDialog.cpp

     文件       1449  2006-03-26 23:19  CUS_OPCClient\ItemPropertiesDialog.h

     文件       8740  2006-04-10 08:51  CUS_OPCClient\LeftView.cpp

     文件       1935  2006-03-26 18:27  CUS_OPCClient\LeftView.h

     文件        503  2006-01-11 01:50  CUS_OPCClient\Lock.h

     文件       6874  2007-03-14 13:55  CUS_OPCClient\MainFrm.cpp

     文件       1799  2006-03-21 10:37  CUS_OPCClient\MainFrm.h

     文件        490  2006-03-26 20:53  CUS_OPCClient\message.h

     文件       2457  2006-03-26 14:39  CUS_OPCClient\MessageView.cpp

     文件       1507  2006-03-26 14:39  CUS_OPCClient\MessageView.h

     文件      23571  2006-03-21 14:36  CUS_OPCClient\old_opcwrap.h

     文件      16546  2007-03-14 14:33  CUS_OPCClient\OPCClientDoc.cpp

............此处省略40个文件信息

评论

共有 条评论