第二课 C#调用易语言编写的dll

本课先用易语言编写一个dll ,视频教程演示了用C#来调用易语言编写的Dll.

易语言DLL源码:

.版本 2
 
.子程序 add, 整数型, 公开
.参数 x, 整数型
.参数 y, 整数型
 
返回 (x + y)
 
 
.版本 2
 
.子程序 msg, , 公开
.参数 a, 整数型
.参数 b, 整数型
 
信息框 (到文本 (a) + “+” + 到文本 (b) + “=” + 到文本 (a + b), 0, “C#调用易语言Dll”, )

C#调用DLL源码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
 
namespace msg
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        [DllImport("msg.dll")]
        static extern IntPtr msg(int a, int b);
        private void button1_Click(object sender, EventArgs e)
        {
            msg(10, 25);
        }
    }
}

优酷视频链接:

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

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

交流①群:521068947

交流②群:877492966

511遇见QQ: 272586593

分享到:

用微信扫一扫,分享给朋友


发布日期:

所属分类: 编程、编程语言 标签: