COM 类可见性:C# 到 VB6

发布于 2024-10-21 20:43:22 字数 976 浏览 2 评论 0原文

我一方面有一个 C# .Net 4.0 应用程序,另一方面有一个 VB6 应用程序。我通过使项目 COM 可见并激活注册 COM Interop 来创建 COM 接口。

我通过实现导入新 tlb 文件的 C# 应用程序来测试 COM 接口。一切似乎都很好。

下一步我尝试将 dll 与 vb6 一起使用。可以加载 dll,但现在我看不到所有公共类。在 C# 中,我看到 4 个类,在 vb6 中我只能看到 3 个。

我看不到的类是一个“特殊”类,因为它实现了一个接口并提供事件服务。

该类标记为

[ComSourceInterfaces(typeof(COMEvents))]

,并且 COMEvents 接口就像

[Guid("11947063-4665-4DE1-931D-9915CCD01794")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface COMEvents 
    {
        void MethodOne();
        void MethodTwo();
    }

我不得不说的那样,一切都工作正常。我添加了一个项目,该项目仅影响由 COM 接口项目在运行时加载的其他程序集。他们实现了一个改变的接口。这是我对 com 接口所做的唯一更改是向方法添加附加参数。

为什么我再也看不到班级了?为什么只是我改变了班级,但没有“冒险”的方式?

需要帮助谢谢!

附: 到目前为止我尝试过: ->所有项目都是Build x86 ->在 x86 机器上构建项目 -> Dependency Walker(GPSVC.DLL 和 IESHIMS.DLL 丢失,但它们之前也这样做过,我认为它们没有任何影响,因为 tlb 已构建并且可以加载) ->尝试了 tlbexp.exe 但出现依赖错误,因为组件运行时比当前运行时更新。什么鬼?)

I have a C# .Net 4.0 Application on the one hand and on the other a VB6 App. I created a COM Interface by making the Project COM Visible and actived register COM Interop.

I Tested the COM interface by implementing a C# Application wich imports the new tlb file. All seems to be fine.

As next step I tried to use the dll with vb6. The dll could be loaded but now i can't see all public classes. In C# I see 4 classes in vb6 I can only see 3.

The class I can't see is a "special" one cause it impelements an interface and serves events.

The class is marked with

[ComSourceInterfaces(typeof(COMEvents))]

and the COMEvents interface is like

[Guid("11947063-4665-4DE1-931D-9915CCD01794")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface COMEvents 
    {
        void MethodOne();
        void MethodTwo();
    }

I have to say that all worked fine. Than i added a project which only effects other assemblys wich are loaded on runtime by the COM interface project. They implement an interface which changed. Thats the only change i made to the com interface is adding additonal parameter to a method.

Why can't I see the Class any more? And why is it only the class I changed but in no "risky" way?

need help thanks!

P.S:
I Tried up to now:
-> all Project are Build x86
-> Project Build on x86 Machine
-> Dependency Walker(GPSVC.DLL and IESHIMS.DLL are missing but they did also before and i don't think they have anny effect cause the tlb is build and could be loaded)
-> tryied tlbexp.exe but get an dependencie error cause assambly runtime is newer than current one. wtf?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热风软妹 2024-10-28 20:43:22

发现它...有带有 2 个参数的构造函数,而 VB6 不支持带有多个零参数的构造函数。

Found it... had constructor with 2 parameters and VB6 does not support constructors with more then zero parameters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文