WindowsAPIの利用

Last-modified: 2020-05-25 (月) 15:53:52

まだメモ

  • using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
class Example
{
    // Win32のMessageBox関数を使うためにDllImportを行う。
    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);
    static void Main()
    {
        // MessageBox関数を呼び出す。
        MessageBox(new IntPtr(0), "Hello World!", "Hello Dialog", 0);
    }
}