Created
March 19, 2023 06:23
-
-
Save un4ckn0wl3z/6a1cd3c55616e6923cffebaa92790d36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using DInvoke.DynamicInvoke; | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
[UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode)] | |
delegate int MessageBoxW(IntPtr hWnd, string lpText, string pCaption, uint uType); | |
static void Main(string[] args) | |
{ | |
var parameters = new object[] { IntPtr.Zero, "My first D/Invoke!", "Hello World", (uint)0 }; | |
Generic.DynamicAPIInvoke("user32.dll", "MessageBoxW", typeof(MessageBoxW), ref parameters); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment