Use the namespace
using System.Runtime.InteropServices;
Then use DllImport
"DllImportAttribute Class Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point."
Use the lines below
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr hWnd,String Text,String Caption,uint type);
InPtr This type implements the ISerializable interface.
And then put this code
MessageBox(new IntPtr(0), "Hello World", "Hello Dialog name", 0);
Note: |
The DllImportAttribute does not support marshaling of generic types. |
Comments