using System.Runtime.InteropServices;
class DllImport{
[DllImport("User32.dll")]
public static extern int MessageBox(int i, string text, string title, int type);
public static void Main() {
MessageBox(0, "Messagebox test", "DllImport Test", 2);
}
}




이게 2.0에는 MessageBox가 없는 모양이더군요.
감사합니다.
"3.5, 3.0에서 지원"
WIN32 API를 호출하여 사용하는 예제였는데요..
XP SP3 에서는 .net framework 2.0으로 컴파일해도 정상적으로 되던데요..
아래는 winform에서 테스트한 소스입니다.
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
[DllImport("User32.dll")]
public static extern int MessageBox(int i, string text, string title, int type);
public Form1()
{
InitializeComponent();
MessageBox(0, "Messagebox test", "DllImport Test", 2);
}
}
}