从 c# 调用 vb6 dll [英] Calling vb6 dlls from c#

查看:31
本文介绍了从 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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