如果需要查看更多文章,請微信搜索公眾號 csharp編程大全,需要進C#交流群群請加微信z438679770,備注進群, 我邀請你進群! ! !


/*c#在呼叫c++方法或者window api時不能象呼叫c#本身寫的dll類別庫那樣直接通過參考dll就可以呼叫相應的方法, 而是要把要參考的dll放到bin中,現通過[DllImport("User32.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 API
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll")]
public static extern int MessageBoxA(int h, string m, string c, int type);
[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);
[DllImport("User32.dll")]
public static extern int GetDoubleClickTime();
// public static extern int SendMessageA(int h, int m, int c, int type);
private void button1_Click(object sender, EventArgs e)
{
MessageBoxA(0, "API Message Box", "API Demo", 0);
MessageBox(0, "API Message Box", "API Demo", 0);
MessageBox(0,GetDoubleClickTime().ToString(), "API Demo", 0);
System.Windows.Forms.MessageBox.Show("111");
// SendMessageA(0, 11, 22, 0);
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/195851.html
標籤:.NET技术
上一篇:C#多執行緒實體
