使用OPCDAAuto.dll编写C# OPC采集程序

时间:2014-12-13 06:10:45   收藏:0   阅读:951

在一台新机器上运行使用OPC自动化接口编写的C#程序报错如下:

索 COM 类工厂中 CLSID 为 {28E68F9A-8D75-11D1-8DC3-3C302A000000} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。

在我的笔记本上运行成功,注册表搜索如下:

bubuko.com,布布扣

下面是这个接口的.NET源码:

namespace OPCAutomation
{
    using System.Runtime.InteropServices;
    
    [ComImport, Guid("28E68F92-8D75-11D1-8DC3-3C302A000000"), CoClass(typeof(OPCServerClass))]
    public interface OPCServer : IOPCAutoServer, DIOPCServerEvent_Event
    {
    }
}

拷贝出OPCDAAuto.dll进行注册,成功运行。

文件下载:OPCDAAuto.dll

bubuko.com,布布扣 bubuko.com,布布扣

下图是.net程序引用之后

bubuko.com,布布扣

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!