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

查看:96
本文介绍了调用从C#VB6的dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图调用从C锋利的应用程序VB6的DLL,不使用注册表。我想同时使用它使用DLL的路径。我无法创建类的VB的dll的对象。请帮忙!到目前为止,我写的代码如下:

 大会ASSEM = Assembly.LoadFile(DLL路径); 
型classType所= assem.GetType(类名);
MethodInfo的方法= classType.GetMethod(秀); //我methos被称为秀
method.Invoke(NULL,NULL); //我有使用类对象,对此我无法创建
调用方法


解决方案

一个VB6 DLL是一个COM DLL。 。通常你会注册DLL(注册表),然后添加从你的.NET项目到VB6 DLL的引用



这的 MSDN文章给出了使用免费的注册表-COM从.NET应用程序的演练。


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

解决方案

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.

This MSDN article gives a walkthrough of using registry-free COM from a .Net app.

这篇关于调用从C#VB6的dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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