第九课 易语言调用C#编写的Dll

本课视频演示了易语言调用C#编写的Dll

C#编写的Dll源码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
 
namespace test
{
    public interface IClassMath
 
    {
        int add(int a, int b);
        int sub (int a, int b);
    }
    [ClassInterface(ClassInterfaceType.None)]
 
    public class ClassMath : IClassMath
    {
        public int add(int a, int b)
        {
           return a+b;
        }
       public int sub(int a, int b)
        {
           return a-b;
        }
    }
  }

易语言调用C#编写的Dll源码

.版本 2

.程序集 类_C, , 公开
.程序集变量 obj, 对象

.子程序 _初始化, , , 当基于本类的对象被创建后,此方法会被自动调用

obj.创建 (“test.ClassMath”, “test.dll”)

.子程序 _销毁, , , 当基于本类的对象被销毁前,此方法会被自动调用

.子程序 add, 整数型, 公开
.参数 a, 整数型
.参数 b, 整数型

返回 (obj.数值方法 (“add”, a, b))

.子程序 sub, 整数型, 公开
.参数 a, 整数型
.参数 b, 整数型

返回 (obj.数值方法 (“sub”, a, b))

.版本 2

.程序集 窗口程序集_启动窗口
.程序集变量 a, 类_C

.子程序 _按钮_add_被单击

编辑框3.内容 = 到文本 (a.add (到整数 (编辑框1.内容), 到整数 (编辑框2.内容)))

.子程序 _按钮_sub_被单击

编辑框6.内容 = 到文本 (a.sub (到整数 (编辑框4.内容), 到整数 (编辑框5.内容)))

优酷土豆链接:9-易语言调用C#编写的Dll

优酷全部教程播单:http://i.youku.com/i/UNTU3NDYyODg0/playlists

易语言Dll编写调用及Hook注入:511遇见易语言Dll编写调用及Hook注入

交流①群:521068947

交流②群:877492966

511遇见QQ: 272586593

511遇见QQ: 906125731


发布日期:

所属分类: 编程 标签: