External Method : DllImport « Windows « C# / CSharp Tutorial






using System;
using System.Text;
using System.Runtime.InteropServices;

class MainClass
{
   [DllImport("kernel32", SetLastError = true)]
   public static extern int GetCurrentDirectory(int a, StringBuilder b);

   static void Main()
   {
      StringBuilder sb = new StringBuilder();
      sb.Length = 250;
      GetCurrentDirectory(250, sb);
      Console.WriteLine(sb);
   }
}








29.12.DllImport
29.12.1.DllImport: load dll library
29.12.2.DllImport
29.12.3.External Method
29.12.4.Get address of a method from Dll
29.12.5.API File reader