COM对象(没有类型库) - 如何从VB.NET访问界面? [英] COM object (no type library) - how do I access the interface from VB.NET?

查看:77
本文介绍了COM对象(没有类型库) - 如何从VB.NET访问界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个COM对象,它直接实现了IDataObject

接口。看起来这与我们现在拥有的带有.NET的
的IDataObject接口不一样。基本上,COM对象实现低级接口。它

没有类型库。我们可以在我们的非托管C ++

项目中自由使用它。我想做的是在

VB.NET中加载或创建其中一个对象,但我似乎无法做到。


我''我试过:


将对象调暗为对象

theObject = GetObject(" c:\gas.tgw")* gas.tgw是一个文件类型我们

与COM对象相关


但是如何从对象中获取IDataObject接口?


是否可以在VB.NET中使用基本的低级COM接口?


任何答案都会非常感激。


I have a COM object, which implements straightforwardly the IDataObject
interface. It seems this isn''t the same IDataObject interface we now have
with .NET. Basically, the COM object implements low level interfaces. It
does not have a type library. We use it freely with our unmanaged C++
projects. What I would like to do is load or create one of these objects in
VB.NET, but I cannot seem to do it.

I''ve tried:

Dim theObject As Object

theObject = GetObject ( "c:\gas.tgw" ) * gas.tgw is a file-type we
associated with the COM object

but how do I get the IDataObject interface from theObject?

Is it possible to use basic low-level COM interfaces with VB.NET?

Any answers would be much appreciated.

推荐答案



" Robin Tucker" < R ****** @ thermoteknix.com>。在消息中写道

news:bk ******************* @ news.demon.co.uk ...

"Robin Tucker" <r.******@thermoteknix.com> wrote in message
news:bk*******************@news.demon.co.uk...

我有一个COM对象,它直接实现了IDataObject
接口。看起来这与我们现在使用.NET的IDataObject接口不一样。基本上,COM对象实现低级接口。它没有类型库。我们可以在我们的非托管C ++项目中自由使用它。我想做的是在VB.NET中加载或创建这些对象中的一个
,但我似乎无法做到。

我试过了:
<将对象调暗为对象

对象= GetObject(" c:\gas.tgw")* gas.tgw是我们与COM对象关联的文件类型

但如何从对象中获取IDataObject接口?

是否可以在VB.NET中使用基本的低级COM接口?

I have a COM object, which implements straightforwardly the IDataObject
interface. It seems this isn''t the same IDataObject interface we now have
with .NET. Basically, the COM object implements low level interfaces. It
does not have a type library. We use it freely with our unmanaged C++
projects. What I would like to do is load or create one of these objects in VB.NET, but I cannot seem to do it.

I''ve tried:

Dim theObject As Object

theObject = GetObject ( "c:\gas.tgw" ) * gas.tgw is a file-type we
associated with the COM object

but how do I get the IDataObject interface from theObject?

Is it possible to use basic low-level COM interfaces with VB.NET?




当然,您可以使用COM接口,但需要一个类型库。然后你需要生成一个Interop程序集。


类型库可以嵌入到dll中,或者你可以创建它如果你

有MSIL接口定义。


David



Sure, you can use the COM interfaces but you need a type library. Then you
need to generate an Interop Assembly.

The type library may be embedded in the dll, or you could create it if you
have the MSIL interface definitions.

David


所以我肯定需要一个类型库?我们无法为此程序生成一个

- 它在COM中实现了IDataObject,但它不是一个

自动化对象。我原以为只是在使用FindInterfaces查找界面

的情况。但显然不是。在这种情况下,

VB.NET不能正常支持我猜,如果它只支持对象类型为libs的对象



" David Browne" < davidbaxterbrowne没有盆栽 me**@hotmail.com >写在

消息新闻:O6 ************** @ TK2MSFTNGP12.phx.gbl ...
So I definately need a type library? There is no way we can generate one
for this program - it implements IDataObject in COM but it isn''t an
automation object. I would have thought it would just be a case of finding
the interface using "FindInterfaces". But obviously not. In this case,
VB.NET can''t be properly supporting com I guess, if it only supports objects
with type libs.

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:O6**************@TK2MSFTNGP12.phx.gbl...

" ;罗宾塔克 < R ****** @ thermoteknix.com>。在消息中写道
新闻:bk ******************* @ news.demon.co.uk ...

"Robin Tucker" <r.******@thermoteknix.com> wrote in message
news:bk*******************@news.demon.co.uk...
接口。看起来这不是我们现在
与.NET一样的IDataObject接口。基本上,COM对象实现低级接口。
它没有类型库。我们可以在我们的非托管C ++项目中自由使用它。我想做的是在

I have a COM object, which implements straightforwardly the IDataObject
interface. It seems this isn''t the same IDataObject interface we now have with .NET. Basically, the COM object implements low level interfaces. It does not have a type library. We use it freely with our unmanaged C++
projects. What I would like to do is load or create one of these
VB.NET中加载或创建其中一个

objects in


对象,但我似乎无法做到。
我试过了:

将对象变暗为对象

对象= GetObject(" c:\ gas.tgw")* gas.tgw是一个文件 - 类型我们
与COM对象相关

但如何从对象中获取IDataObject接口?

是否可以使用基本的低级COM接口VB.NET?

VB.NET, but I cannot seem to do it.

I''ve tried:

Dim theObject As Object

theObject = GetObject ( "c:\gas.tgw" ) * gas.tgw is a file-type we
associated with the COM object

but how do I get the IDataObject interface from theObject?

Is it possible to use basic low-level COM interfaces with VB.NET?



当然,您可以使用COM接口,但需要一个类型库。然后你需要生成一个Interop程序集。

类型库可以嵌入到dll中,或者你可以创建它,如果你有MSIL接口定义。

大卫



Sure, you can use the COM interfaces but you need a type library. Then you
need to generate an Interop Assembly.

The type library may be embedded in the dll, or you could create it if you
have the MSIL interface definitions.

David





" Robin Tucker" < R ****** @ thermoteknix.com>。在消息中写道

news:bk ******************* @ news.demon.co.uk ...

"Robin Tucker" <r.******@thermoteknix.com> wrote in message
news:bk*******************@news.demon.co.uk...
所以我肯定需要一个类型库?我们无法为此程序生成一个
- 它在COM中实现了IDataObject,但它不是一个自动化对象。我原本以为只是
使用FindInterfaces查找界面的情况。但显然不是。在这种情况下,如果VB.NET只支持类型为libs的
对象,那么VB.NET不能正常支持com。
So I definately need a type library? There is no way we can generate one
for this program - it implements IDataObject in COM but it isn''t an
automation object. I would have thought it would just be a case of finding the interface using "FindInterfaces". But obviously not. In this case,
VB.NET can''t be properly supporting com I guess, if it only supports objects with type libs.




非托管C ++程序如何使用此组件?


他们是否有接口定义?

他们使用IDispach吗?

David



How do the unmanaged C++ programs use this component?

Do they have the interface definitions?
Do they use IDispach?

David


这篇关于COM对象(没有类型库) - 如何从VB.NET访问界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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