調用外部的DLL(DllImportAttribute)

using System;
using System.Runtime.InteropServices;

class Example
{
    
// Use DllImport to import the Win32 MessageBox function.
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    
public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);

    
static void Main()
    {
        
// Call the MessageBox function using platform invoke.
        MessageBox(new IntPtr(0), "Hello World!""Hello Dialog"0);
    }
}
posted @ 2008-09-11 16:58  Athrun  阅读(514)  评论(0编辑  收藏  举报