#调用vc编写的dll,无法加载 DLL
无法加载 DLL“Mercator.dll”: 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (异常来自 HRESULT:0x800736B1)。[DllImport("Mercator.dll", CharSet = CharSet.Ansi)]
public extern static void Mercator_Create(string filepath);
[DllImport("Mercator.dll", CharSet = CharSet.Auto)]
public extern static void Mercator_Map2Device(int world_left, int world_right, int world_top, int world_bottom, int device_left, int device_right, int device_top, int device_bottom, int device_center_x, int device_center_y, int x, int y, ref int out_x, ref int out_y);
[DllImport("Mercator.dll", CharSet = CharSet.Auto)]
public extern static void Mercator_Device2Map(int world_left, int world_right, int world_top, int world_bottom, int device_left, int device_right, int device_top, int device_bottom, int device_center_x, int device_center_y, int x, int y, ref int out_x, ref int out_y);
[DllImport("Mercator.dll", CharSet = CharSet.Ansi)]
public extern static void Mercator_Release();
public Mercator()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string strPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf(@"\")) + "\\mercator.db";
Mercator_Create(strPath);
MessageBox.Show("TestSucceed");
}
catch
{
MessageBox.Show("TestFailure");
}
}
请高手帮帮忙解决一下啊! 谢谢了!DLL文件已放在了与EXE同级目录中 --------------------编程问答-------------------- 你看下 strPath 有没有问题。 --------------------编程问答-------------------- CharSet.Auto都改成ansi --------------------编程问答-------------------- up
补充:.NET技术 , C#