zoukankan      html  css  js  c++  java
  • OPC客户端设计

    1. 开发环境配置

      要安装和开发OPC程序,安装必要的OPC代理/存根(Proxy/Stub)DLL是必需的,这些文件提供了OPC接口的数据结构定义,可以使OPC客户端程序和服务器程序之间进行有效的通信。

      所有文件必须安装在客户端机器和服务器端机器上。要将这些文件放置在system32系统文件夹下。

    需要文件:

      这些文件包括:

      opc_aeps.dll    //警报与时间服务器代理/存根

      opccomn_ps.dll   //公用的代理/存根(主要服务器都需要)

      opchda_ps.dll   //历史数据存取代理/存根

      aprxdist.exe     //运行环境需要

      opcenum.exe      //服务器类别搜索组建程序(都需要),如果没有,就无法在注册表中进行注册

    安装方法:

      将上述文件全部复制到windows\system32目录下。

      安装代理/存根:

        REGSVR32 opcproxy.dll

        REGSVR32 opccomn_ps.dll

        REGSVR32 opc_aeps.dll

        REGSVR32 opchda_ps.dll

      安装opcenum.exe

        opcenum /regserver

     

    //CComPtr: Smart pointer

    CComPtr<IOPCServerList> pOPCServerList;

    //Creates a single uninitialized object of the class associated with a specified CLSID.
    hr = pOPCServerList.CoCreateInstance( CLSID_OpcServerList );

    //A specified class is not registered in the registration database. Also can indicate that the type of server you requested in the CLSCTX enumeration is not registered or the values for the server types in the registry are corrupt.

    //to register, you need to run opcenum.exe

    if(REGDB_E_CLASSNOTREG == hr)
      return FALSE;

    if( FAILED( hr ) )
      return FALSE;

    The return value of function CoCreateInstance:
     
    ValueDescription

    S_OK

    An instance of the specified object class was successfully created.

    REGDB_E_CLASSNOTREG

    A specified class is not registered in the registration database. Also can indicate that the type of server you requested in the CLSCTX enumeration is not registered or the values for the server types in the registry are corrupt.

    CLASS_E_NOAGGREGATION

    This class cannot be created as part of an aggregate.

  • 相关阅读:
    3D引擎为什么使用三角形绘制曲面
    用SublimeText当Unity Shader的编辑器
    Lua模块的加载与内存释放
    wriesharek同时监听多个端口
    Unity的Input输入
    Unity项目中文字的统一管理
    Unity中的定时器与延时器
    Unity插件扩展中组件常用的几个方法
    u3d不显示阴影的处理方法
    使用ScriptableObject创建.asset文件
  • 原文地址:https://www.cnblogs.com/johnpher/p/2720218.html
Copyright © 2011-2022 走看看