/ Published in: C#
URL: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx
[1] Add 'using System.Runtime.InteropServices;' [2] Add DllImport and function declaration [3] call function.
This example involves passing strings and passing IntPtr.
Expand |
Embed | Plain Text
using System; using System.Runtime.InteropServices; class Example { // Use DllImport to import the Win32 MessageBox function. [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type); static void Main() { // Call the MessageBox function using platform invoke. } }
You need to login to post a comment.
