用vc编写的MFC Dll程序在C#中调用 dll提供的是DCOM的接口函数
调用如下:
namespace AClasstest
{
using System.Runtime.InteropServices;
using System.ComponentModel;
class CDll
{
[DllImport("DcomDll.dll", EntryPoint = "test", SetLastError = true)]
public static extern int test();
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
int c = 0;
c = CDll.test();
if (c == 1)
MessageBox.Show("1");
else
MessageBox.Show("0");
}
}
}
在VS中编译后运行的时候不能够正确连接DCOM的服务,但是在生成好后的文件下运行的时候能够正确运行一次,然后后面就不成功。但在vc的应用程序的情况下是能够正常运行的。
希望做过这方面的朋友帮忙解决下!
调用如下:
namespace AClasstest
{
using System.Runtime.InteropServices;
using System.ComponentModel;
class CDll
{
[DllImport("DcomDll.dll", EntryPoint = "test", SetLastError = true)]
public static extern int test();
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
int c = 0;
c = CDll.test();
if (c == 1)
MessageBox.Show("1");
else
MessageBox.Show("0");
}
}
}
在VS中编译后运行的时候不能够正确连接DCOM的服务,但是在生成好后的文件下运行的时候能够正确运行一次,然后后面就不成功。但在vc的应用程序的情况下是能够正常运行的。
希望做过这方面的朋友帮忙解决下!
解决方案 »
- 怎样去除DateTimePicker边框的3D效果?
- 只允许输入汉字、数字、26个英文字母的正则表达式
- 请问如何确定当前OS是否是Vista64?
- c#开发的手机程序怎样检测手机信号?答对了给100分!!!
- 如何在新线程启动的类中对 RichTextBox.Text 的改写.............
- [讨论]大家一般都怎么控制字符长度输入的
- 如何修改光标作用点阿?
- udp广播----------如何同时传播文字和图片?
- C#程序编译出现错误..
- outlook插件开发
- 请问“Asp.net WEB服务”和“Asp.net Web应用程序”有什么区别
- 如何确定用户是否选取了webBrowser内的checkbox1
MyDll.ToDoCloseDLL里面的ToDoClose方法执行本身释放Close或者dispose之类的操作
函数里面CDll.test
例如
a=1
代码
a=2
.....代码
return a '先别返回正确与否看看问题出在哪一行,确定了才好解决。