c#中如何调用dll文件,请大侠指点

解决方案 »

  1.   

    [System.Runtime.InteropServices.DllImport("user32.dll",EntryPoint="SendMessage")]
    public static extern int SendMessage(int hWnd,int wMsg,int wParam,int lParam);
      

  2.   

    添加引用-〉瀏覽 選擇你要的dll
      

  3.   

    [System.Runtime.InteropServices.DllImport("user32.dll",EntryPoint="SendMessage")]
    public static extern int SendMessage(int hWnd,int wMsg,int wParam,int lParam);
      

  4.   

    .NET写的类编译的DLL就“引用”,别的写的符合DLL接口的就DllImport
      

  5.   

    在解决方案资源管理器中,的引用中直接添加,然后在代码中要用using 去引用名字空间,然后可以使用.dll中的控件和类
      

  6.   

    非托管的DLL要先注册一下 regsvr32 ,之后填加引用,就OK了