第三方DLL导入问题 [英] Third party DLL import problem

查看:71
本文介绍了第三方DLL导入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一家IT公司工作,负责将VB项目转换为VB.NET的任务. Evrything在转换中进展顺利,结果是在VB.NET中的代码进行了一些细微更改之后,我获得了成功的构建.

但是当我使项目运行时,它抛出了运行时异常,因为由于以下错误,从IClassFactory创建具有CLSID {XXXXX}的COM组件的实例失败,原因是:80004004".当项目访问参考文件(在属性中文件类型为ACTIVEX的DLL)时.

奇怪的是VB使用的Dll名称是EXECU.dll.但是在转换之后,引用已更改为interop.ECECU.dll

即使当我尝试将引用手动添加到DLL EXECU.dll时,其引用也会自动将其名称更改为interop.EXECU.dll.

当我在对象浏览器中浏览dll内容时,我发现DLL在名称空间(库)中包含EXECU类,但该类中没有任何功能.

I work in an IT company where I was given a task to convert a VB project to VB.NET. Evrything went well in the conversion and as a result I got a successfull build after some minor changes in the code in VB.NET.

But when I made the project to run, it throwed a run time exception as "Creating an instance of the COM component with CLSID {XXXXX} from the IClassFactory failed due to the following error :80004004" when the project accessed a reference file (DLL which has file type as ACTIVEX in its properties).

The strange thing is the Dll name used by VB was EXECU.dll. But after the conversion the reference was changed to interop.ECECU.dll

Even when I tried to add the reference manually to the dll EXECU.dll, its refernce automatically changes its name to interop.EXECU.dll.

When I browsed the dll content in the object browser I found that the DLL was having the class EXECU inside the namespace (library) but the class was not having any function in it.

Do I have to run anything to get the full functionality of the original DLL?

推荐答案

尝试注册COM +
命令:

C:\ Program Files \ Microsoft Visual Studio 9.0 \ VC>
RegAsm Example.dll/tlb:Example.tlb/codebase

注意:请勿使用regsvr32来注册COM +.
Try registering COM+
Command:

C:\Program Files\Microsoft Visual Studio 9.0\VC>
RegAsm Example.dll /tlb:Example.tlb /codebase

Note: Do not use regsvr32 for registering COM+.



我找到了答案.该dll是COM类型(不是.NET类型).因此,我们只需要通过regsvr32进行注册.此外,错误创建COM实例"与dll中的注册表安全性有关(我们无法执行任何操作.它仅在特定的服务器中有效):(

还是谢谢.

现在,我了解了将COM类型的dll导入.NET的基本步骤.
1)注册(使用regsvr32)

2)通过
转换为.NET类型 a)将注册的COM DLL(Active X)添加到引用(或)
时自动转换 b)使用tlbimp(.dll)手动进行覆盖,然后将其添加为引用.
Hi,
I found the answer. This dll was a COM type (Not .NET type). So we have to register only by regsvr32. Further the error "Creating an instance of the COM" was related to registry security in the dll (nothing can be done by us. It works only in specific servers) :(

Anyway thanks.

Now I got to know the basic steps in importing a COM type dll to .NET

1)Registration (Using regsvr32)

2)Converting to .NET type either by
a)Automatic conversion when you add the registered COM DLL (Active X) to the reference (or)
b)Coverting manually by using tlbimp (.dll) and then adding it as reference.


这篇关于第三方DLL导入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆