/ Published in: C#

[1] Add 'using System.Runtime.InteropServices;'
[2] Add DllImport and function declaration
[3] call function.
This example involves passing strings and passing IntPtr.
[2] Add DllImport and function declaration
[3] call function.
This example involves passing strings and passing IntPtr.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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. } }
URL: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx
Comments
