连接点网络互操作没有idispatch [英] Connection point net interop no idispatch

查看:66
本文介绍了连接点网络互操作没有idispatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为如果我将连接点直接暴露给Net,则没有为COM连接点创建库,它们在C#中显示为在我的DLL命名空间下。有没有办法在不使用IDispatch的情况下正确地将Connection Point接口暴露给Net?



我尝试了什么:



包装接口并代理连接。

Because no library is created for COM Connection Points if I expose Connection Points directly to Net they appear in C# as being under my DLL's namespace. Is there a way to properly expose the Connection Point interfaces to Net without using IDispatch?

What I have tried:

wrapping the interfaces and brokering the connection.

推荐答案

听起来你的构建设置有些问题。连接点源自iDispatch,因此它们是内在的,您需要更好地理解该技术。阅读明确的 COM连接点以更好地理解它。



提示:使用Visual Studio向导创建一个新项目并将代码导入其中。 (或将设置与项目进行比较)
Sounds like you have some problems in your build settings. Connection points are derived from iDispatch, so they are immanent and you need understand that technique better. Read the articel COM Connection Points to understand it better.

Tip: create a new project with the Visual Studio wizard and import your code into it. (or compare the settings with your project)


连接点接口在OCidl.idl中定义。所有四个接口都直接来自IUnknown接口,而不是IDispatch。我的问题的解决方案与项目设置无关。我认为核心问题是我没有使用atl。 atl默认创建自动化服务器。当atl创建连接点时,它会创建自动化接口或双接口。使用com 1.0 coclass没有任何问题。至于命名空间,它就像有一个类派生出来自iunknown的多个接口。在转换为iunknown时,你应该通过其中一个派生接口进行转换。



至少这是我对它的看法。
the connection point interfaces are defined in OCidl.idl. all four interfaces derive directly from IUnknown interface and not IDispatch. the solution to my problem has nothing to do with project settings. i believe the core problem is i am not using atl. atl creates an automation server by default. when atl creates a connection point it creates either an automation interface, or a dual interface. there is nothing wrong with using a com 1.0 coclass. as for the namespace, it's just like having a class that derives multiple interfaces that derive from iunknown. when casting to iunknown, you should be casting through one of the derived interfaces.

at least that's my take on it.


这篇关于连接点网络互操作没有idispatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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