There is a need to call the WinAPI function from C # code. What language tools allow you to do this?

    1 answer 1

    There are different approaches. Practical recommendations on the interaction of managed and machine code .

    For example, if you use P / Invoke from C #, then it looks like this:

    using System; using System.Runtime.InteropServices; namespace Sample { class Program { static void Main(string[] args) { MessageBox(IntPtr.Zero, "Hello, World!", "", 0); } [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern int MessageBox(IntPtr hWnd, String message, String caption, int options); } }