www.pudn.com > funcdll.rar > Form1.cs, change:2011-02-14,size:1292b


´╗┐using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using System.Runtime.InteropServices; 
 
 
 
namespace CSfuncApp 
{ 
    public partial class CSfuncapp : Form 
    { 
        [DllImport("kernel32.dll")] 
        public static extern IntPtr LoadLibrary(String lpFileName); 
 
 
        [DllImport("funcdll.dll")] 
        private extern static int Add(int var1,int var2); 
        [DllImport("funcdll.dll")] 
        private extern static int Minus(int var1, int var2); 
        [DllImport("funcdll.dll")] 
        private extern static void GetVer(byte[] str1); 
 
 
        public CSfuncapp() 
        { 
            InitializeComponent(); 
        } 
 
        private void ButtonTest_Click(object sender, EventArgs e) 
        { 
            string teststr = "\r\nhello"; 
            byte[] tempsbyte=new byte[100]; 
            textBoxEcho.Text = Add(1, 2).ToString(); 
            textBoxEcho.AppendText(teststr); 
            teststr = "\r\n"+Minus(1, 2).ToString()+"\r\n"; 
            textBoxEcho.AppendText(teststr); 
            GetVer(tempsbyte); 
            textBoxEcho.AppendText(System.Text.Encoding.ASCII.GetString(tempsbyte)); 
        } 
    } 
}