How to use MessageBox() Windows API function in C#

1 Answer

0 votes
using System;
using System.Runtime.InteropServices;

namespace API
{
	class Class1
	{
		[DllImport("user32.dll", CharSet=CharSet.Unicode)] 
		public static extern int MessageBox(int h, string m, string c, int type); 
		
		static void Main(string[] args)
		{
			string pText = "Hello World!"; 
			string pCaption = "MessageBox API"; 
			MessageBox(0, pText, pCaption, 0); 
		}
	}
}


answered Aug 9, 2014 by avibootz

Related questions

1 answer 526 views
1 answer 2,467 views
1 answer 4,008 views
1 answer 500 views
500 views asked Dec 12, 2014 by avibootz
1 answer 122 views
...