Following is the example to use it properly This is from msdn for more visit http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx
using System; using System.Runtime.InteropServices;
class Example { // Use DllImport to import the Win32 MessageBox function. [DllImport("user32.dll" CharSet CharSet.Auto)] publicstatic extern int MessageBox(IntPtr hWnd String text String caption uint type);
staticvoid Main() { // Call the MessageBox function using platform invoke. MessageBox(new IntPtr(0) "Hello World!" "Hello Dialog" 0); } }