经过对MSDN的仔细查询,确认调用API函数的方法是通过P/Invoke(平台调用)实现的。如调用API函数MessageBox的方法:using System.Runtime.InteropServices;public class Win32 {
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int MessageBox(int hWnd, String text,
String caption, uint type);
}public class HelloWorld {
public static void Main() {
Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0);
}
}但问题三的答案依然不确定,请知情的朋友指点迷津,谢谢!
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int MessageBox(int hWnd, String text,
String caption, uint type);
}public class HelloWorld {
public static void Main() {
Win32.MessageBox(0, "Hello World", "Platform Invoke Sample", 0);
}
}但问题三的答案依然不确定,请知情的朋友指点迷津,谢谢!
http://www.5ivb.net/club/dispbbs.asp?boardID=22&ID=27820