調用外部的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 @   Athrun  阅读(517)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示