C#调用非托管的代码

    xiaoxiao2025-11-27  16

    using System; using System.Runtime.InteropServices; namespace 调用非托管项目demo { class Program { static void Main(string[] args) { Win32.MessageBox(0, "Hello I am Kun", "stm32", 0); } public class Win32 { [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr MessageBox(int hWnd, String text,String caption, uint type); } } }

    运行结果:

    相关资源:C#调用非托管代码时参考(整理)
    最新回复(0)