50分请教,关于调用dll的问题。 你有没有正确添加呢?new aaa.createAAA()是不是自动生成的,如果不是,应该没有正确添加,我的添加方式是这样的,在要调用dll的程序里,选中右边的添加引用,再选浏览,找到dll文件的的所在,添加就行了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 也有可能是你的dll里的方法都是private的,不能调用 你需要使用 DllImportAttribute 标识 DLL 和函数。用 static 和 extern 修饰符标记方法。你可以看看.NET联机帮助里“在托管代码中创建原型”的说明。下面是它的例子:using System.Runtime.InteropServices;public class Win32 { [DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern int MessageBox(int hWnd, String text, String caption, uint type);}public class HelloWorld { public static void Main() { Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0); }} 上面给出的是调用非托管dll的方法,如果是C#的托管函数,你只要在项目中添加dll引用,再实例化就可以了。 mt_wang 我按找你做了出现了:Could not load type vzoom.pass9WebInterface from assembly vzoom_dotnet, Version=1.0.1763.26590, Culture=neutral, PublicKeyToken=null because the method LoadPubKey has no RVA. 错误这个是什么原因啊 C语言中形参是如何进行地址传送的?? 如何在Winform的页面中获取刷卡机中的数据并弹出窗口 文本框复制问题?? 怎么保存C#处理完的图片啊! ListView 放了背景图片,没有数据的时候能看到背景,有数据怎么就看不到背景了呢? 请教:为什么正确的字符会变成错误:输入字符串的格式不正确? 如何显示一个每一项都可采用不同背景图的文字列表 关于XML在Winform(c#)中的应用~~~ 关于对话框的一个问题? 哪位兄弟有不用安装,直接就可以读PDG文件的东东阿? -----------高手请进,为什么会出错---------- 退出while除了break;还有什么命令?
记方法。你可以看看.NET联机帮助里“在托管代码中创建原型”的说明。下面是它的例子:
using System.Runtime.InteropServices;public class Win32 {
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int MessageBox(int hWnd, String text,
String caption, uint type);
}public class HelloWorld {
public static void Main() {
Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0);
}
}
就可以了。
Could not load type vzoom.pass9WebInterface from assembly vzoom_dotnet, Version=1.0.1763.26590, Culture=neutral, PublicKeyToken=null because the method LoadPubKey has no RVA.
错误这个是什么原因啊