这是一个小例子:using System; using System.Runtime.InteropServices;class PlatformInvokeTest { [DllImport("user32.dll")] public static extern int MessageBoxA( int h, string m, string c, int type); public static int Main() { return MessageBoxA(0, "Hello World!", "My Message Box", 0); } }
using System.Runtime.InteropServices;class PlatformInvokeTest
{
[DllImport("user32.dll")]
public static extern int MessageBoxA(
int h, string m, string c, int type);
public static int Main()
{
return MessageBoxA(0, "Hello World!", "My Message Box", 0);
}
}
谢谢,我可能在问题中说得不明白,我在用webform写的,不是winform。
可不可以写一个aspx文档中用的例子呢?
怎么又出来了?可以导入winform的动态库,然后使用Winform中的Messagebox.