[System.Runtime.InteropServices.DllImport("Kernel32.dll")]
private static extern uint GetWindowsDirectory(StringBuilder strbuffer,int Size);

解决方案 »

  1.   

    http://www.ccw.com.cn/htm/app/aprog/01_9_14_4.asp
    希望对你有帮助
      

  2.   

    我有一个API声明的小工具
    你的email
    我给你传一下
      

  3.   

    using System;
    using System.Runtime.InteropServices;namespace dll
    {
    class pinvokeClient
    {
    [DllImport("user32.dll")] public static extern int MessageBoxA(int hwnd, string message,
    string caption, int type);
                      //声明Api函数的类型 public static void Main()
    {
    int result = MessageBoxA(0, "Hello World", "Dll Test", 3);
    }
    }
    }
      

  4.   

    用APIVIEW2004,这个工具支持很多语言,包括C#!!!
      

  5.   

    像引用普通的dll一样,比如Kernel32.dll
    using System.Runtime.InteropServices;
    [DllImport("Kernel32.dll")]
    private static void xxx();//<----api里的函数名
      

  6.   

    http://www.codeguru.com/Csharp/Csharp/cs_graphics/screencaptures/article.php/c6139
      

  7.   

    [DllImport("winmm.dll", EntryPoint="waveOutGetNumDevs")]
    public static extern int waveOutGetNumDevs ();