BCB6 调用C# DLL
- 作者: 五速梦信息网
- 时间: 2026年04月04日 13:50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices; //1添加Rumtime.InteropServices 程序集引用
using System.Windows.Forms; //2为了演示,所以加入了forms引用
namespace ComImpTest
{
[Guid("3CD116D4-18A1-4504-921B-57C053BAD618")] //3主菜单->工具->创建GUID产生
public interface IComInterface //4必须先定义接口
{
[DispId(1)] //5每一个函数或者属性都需要指定DispID
void Hello(string name);
[DispId(2)]
int Add(int x,int y);
[DispId(3)]
string COMINFO{get;}
}
[Guid("1A8EB38C-E732-49B2-A897-B40FFD744E3D")]
public class ComImp : IComInterface //6编写一个实现接口的类
{
public void Hello(string name)
{
Console.WriteLine("你好"+name);
MessageBox.Show("你好"+name,"C# dll 弹出界面");
}
public int Add(int x, int y)
{
return x + y;
}
public string COMINFO
{
get
{
return "com 测试";
}
}
}
}
- 上一篇: bcm4313驱动 linux
- 下一篇: bat实现监测计算机网络连接,断网自动重启网络连接
相关文章
-
bcm4313驱动 linux
bcm4313驱动 linux
- 互联网
- 2026年04月04日
-
beanpostprocess 责任链
beanpostprocess 责任链
- 互联网
- 2026年04月04日
-
bedtools 每天都会用到的工具
bedtools 每天都会用到的工具
- 互联网
- 2026年04月04日
-
bat实现监测计算机网络连接,断网自动重启网络连接
bat实现监测计算机网络连接,断网自动重启网络连接
- 互联网
- 2026年04月04日
-
bat脚本:windows下一键启动zookeeper+kafka
bat脚本:windows下一键启动zookeeper+kafka
- 互联网
- 2026年04月04日
-
bat调用外部exe
bat调用外部exe
- 互联网
- 2026年04月04日






