Skip to content

Instantly share code, notes, and snippets.

@6rube
Last active April 23, 2023 09:51
Show Gist options
  • Save 6rube/34b561827f0805f73742541b8b8bb770 to your computer and use it in GitHub Desktop.
Save 6rube/34b561827f0805f73742541b8b8bb770 to your computer and use it in GitHub Desktop.
C# .net 6.0 Messagebox for console applications
using System.Runtime.InteropServices;
//Call Win32 API for opening a Messagebox (This does not require any other libarys)
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);
MessageBox(new IntPtr(0), "Message", "Title", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment