c#中dll调用错误DllNotFoundException

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace test2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

[DllImport("ez2000.dll", EntryPoint = "openport")]
public extern static void openport(string port);
private void button1_Click(object sender, EventArgs e)
{
string strlll = "5";
openport(strlll);
}
}
}

错误:{"无法加载 DLL“ez2000.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。"}
我把dll文件放exe一起,还复制了一份放system32下了
这个是dll的说明文档1. openport
Description: select the output port
Command: openport(no)
Input parameters: no: (string) output port ref.
“0” = LPT1
“1” = COM1
“2” = COM2
“3” = COM3
“4” = COM4
“5” = LPT2
“6” = USB

第1个回答  2009-06-17
这不是关于打印的dll嘛 你这样写是对的哦,DllImport会首先到路劲下找dll,然后会到system32下找.如果EntryPoint = "openport"没错,那或许是这个dll还调用其它的dll?我做条码打印时也遇到过.本回答被提问者采纳
第2个回答  2009-06-17
如果DLL没有问题 就建议你在解决方案中的“引用”文件夹下单击右键 然后添加你那DLL文件 看看行不行

参考资料:如果您的回答是从其他地方引用,请表明出处

第3个回答  2009-06-16
应该是你的dll引用的路径写错了吧,检查一下路径
第4个回答  2009-06-16
你的DLL没问题吧

有函数 openport 吗?