调用API的MessageBox!

using System;
using System.Runtime.InteropServices;
namespace 调用Win32的MessageBox
{
    
class Class1
    {
        [STAThread]
        
static void Main(string[] args)
        {
            Class1.MessageBox(
0,"auto","infomation",0);

            Class1.MessageBoxA(
0,"ANSI我","infomation",0);

            Class1.MessageBoxW(
0,"Unicode我","infomation",0);
        }
        [DllImport(
"user32.dll",CharSet=CharSet.Auto)]
        
public static extern int MessageBox(int hWnd,string text,string caption,uint type);

        [DllImport(
"user32.dll",CharSet=CharSet.Ansi)]
        
public static extern int MessageBoxA(int hWnd,string text,string caption,uint type);
      
        [DllImport(
"user32.dll",CharSet=CharSet.Unicode)]
        
public static extern int MessageBoxW(int hWnd,string text,string caption,uint type);

    }
}

posted @ 2006-09-12 16:28  吴东雷  阅读(499)  评论(1)    收藏  举报