我如何使用VB6 COM在IronPython的“参考”? [英] How can I use a VB6 COM 'reference' in IronPython?

查看:147
本文介绍了我如何使用VB6 COM在IronPython的“参考”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发的是或多或少需要从VB 6 COM DLL得到一些数据的脚本。此DLL是在MS Word中VBA项目目前使用的,它出口类等对VBA code。它被添加在工具 - >引用菜单中的VBA编辑器,我可以看到它的类VBA的对象浏览器

I'm currently developing what is more or less a script that needs to get some data from a VB 6 COM dll. This dll is currently used in a MS Word VBA project, and it exports classes, etc to the VBA code. It is added in the Tools -> References menu in the VBA editor, and I can see it's classes in the object browser of VBA.

从我的读数,可以使用一个VB6 COM库在VB.NET(或至少,它应该是能)。作为应该有可能在VB.NET,并且由于.NET运行在CLR的,并且因为IronPython的不来,从逻辑上讲,我不能访问这个古老的DLL从IronPython的?

From my readings, it is possible to use a VB6 COM library in VB.NET (or at least, it is supposed to be able to.) As it should be possible in VB.NET, and since .NET runs on the CLR, and since IronPython does to, logically, can't i access this ancient DLL from IronPython?

我已经试过进口CLR; clr.AddReferenceToFileAndPath(DllPath的)在IronPython的,但要得到。IO错误:文件不存在,这显然是错误的。

I have tried import clr; clr.AddReferenceToFileAndPath(dllpath) in IronPython, but keep getting 'IOError: file does not exist', which is clearly false.

如果任何人都可以点我在/任何/ .NET语言使用VB6 COM对象,这将是极大的AP preciated。

If anyone can point me to using a VB6 COM object in /any/ .NET language, that would be greatly appreciated.

谢谢!

PS:不,我不能编辑/的COM DLL的查看源代码,这是第三方的专有的东西。 PPS:任何方法可以让我得到的GUID / COM的名字;的dll?

PS: No, I can't edit / view source of the COM DLL, it's 3rd party proprietary stuff. PPS: Any way I can get the GUID / COM 'name; of the dll?

推荐答案

您需要装配使用 TLBIMP 工具生成一个运行时COM包装,并添加一个引用;支持.NET属性语言可以做的互操作明确,但即使在那里,autogenerating包装就简单得多了。

You need to generate a Runtime COM Wrapper assembly using the tlbimp tool, and add a reference to that; languages which support .net attributes can do the interoperation explicitly, but even there, autogenerating the wrapper is far simpler.

检查包装组件反汇编将显示究竟是如何转换已经完成。

Inspecting the wrapper assembly in ildasm will show exactly how the conversion has been performed.

这篇关于我如何使用VB6 COM在IronPython的“参考”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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