using System; using System.Runtime.InteropServices; class Test { [DllImport("User32.dll")] ///引用dll,你可以看看 public static extern int MessageBox(int h,string m,string c,int type); public static int Main() { string message; Console.WriteLine("enter the message:"); message=Console.ReadLine(); return MessageBox(0,message,"系统提示",0); } }
若要.net调用直接用csc /r:***.dll即可
using System.Runtime.InteropServices;
class Test
{
[DllImport("User32.dll")] ///引用dll,你可以看看
public static extern int MessageBox(int h,string m,string c,int type);
public static int Main()
{
string message;
Console.WriteLine("enter the message:");
message=Console.ReadLine();
return MessageBox(0,message,"系统提示",0);
}
}