using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

public class MyClass
{
    [DllImport("user32.dll", EntryPoint="MessageBoxW")]
    public static extern int MessageBoxW(
        [In] System.IntPtr hWnd,
        [In] [MarshalAs(UnmanagedType.LPWStr)] string lpText,
        [In] [MarshalAs(UnmanagedType.LPWStr)] string lpCaption,
        uint uType
    );
    
    public static void Main()
    {
        MessageBox.Show("I'm from System.Windows.Forms.MessageBox ","MessageBox from CLR",
            MessageBoxButtons.OK,MessageBoxIcon.Information);
        System.Diagnostics.Process.Start("notepad");
        MessageBoxW(IntPtr.Zero,"This Application invoked MessageBoxW.","p/invoke demo",0x40);
    }
}

相关文章:

  • 2021-12-16
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-02-14
  • 2021-08-29
  • 2022-01-28
猜你喜欢
  • 2021-05-23
  • 2021-09-10
  • 2021-10-06
  • 2021-09-16
  • 2021-05-27
相关资源
相似解决方案