Calling vb6 dlls from c#(从 c# 调用 vb6 dll)
问题描述
我一直在尝试从 C sharp 应用程序调用 vb6 dll,而不使用注册表.我想在使用时使用 dll 的路径.我无法创建 vb dll 类的对象.请帮忙!目前我写的代码如下:
I have been trying to call a vb6 dll from a C sharp application, without using the registry. I want to use the path of the dll while using it. I am unable to create an object of the class of the vb dll. Please help! The code I have written so far is as follows:
Assembly assem = Assembly.LoadFile("dll path");
Type classType = assem.GetType("classname");
MethodInfo method = classType.GetMethod("show"); //My methos is called show
method.Invoke(null,null); // I have to invoke the method using class object, which I am unable to create
推荐答案
VB6 DLL 是 COM DLL.通常您会注册 DLL(在注册表中),然后从您的 .NET 项目中添加对 VB6 DLL 的引用.
A VB6 DLL is a COM DLL. Usually you would register the DLL (in the registry) and then add a reference to the VB6 DLL from your .NET project.
这篇 MSDN 文章 提供了使用免注册 COM 的演练来自 .Net 应用程序.
This MSDN article gives a walkthrough of using registry-free COM from a .Net app.
这篇关于从 c# 调用 vb6 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 c# 调用 vb6 dll


基础教程推荐
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01