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.

  • 相关阅读:
    ObjectARX 学习笔记007:创建模态对话框的一般步骤
    c#的DateTime.Now函数详解
    LinQ 使用案例1
    LinQ 泛型方法Array>ForEach在数组中进行迭代并调用自定义的委托
    LinQ Lambda表达式用作泛型活动
    win7x64bit VS2010 CAD2013断点 调试 捕捉成功,困扰一周的问题解决了
    法兰数据库设计方案
    关于CAD的开发思路
    法兰程序CAD开发的进展
    法兰动态块设计思路
  • 原文地址:https://www.cnblogs.com/johnpher/p/2720218.html
Copyright © 2011-2022 走看看