C#引入win32类库:Dllimport can help you to do something

    技术2022-05-12  13

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;

    namespace Box{    class Program    {        [DllImport("User32.dll")]       public  static extern int MessageBox(int hand, string custom,string title,int type);        static void Main(string[] args)        {            MessageBox(0, "Good","Greeting" ,0);            Console.ReadKey();        }    }}

     

    //just less than 10 lines but very useful,needs no form reference


    最新回复(0)