引用这个dll就可以了!
我的ePass下的。net程序就是这样写的!

解决方案 »

  1.   

    我有一个小例子.....System.Reflection.Assembly mAssembly=System.Reflection.Assembly.LoadFrom(DllStartPathName);
    object[] objArray=new object[n];
    objArray[0]=value1;
    objArray[1]=value2;
    ...
    object m_Myobj =mAssembly.CreateInstance(ClassName,true,System.Reflection.BindingFlags.Default,null,objArray,null,null);
    if (m_Myobj ==null)
    {
    return;
    }
      

  2.   

    1、如果你调用的DLL是Active的(支持自动化接口),用Regsvr32注册后可以引用后直接调用。2、如果你调用的Dll是Win32的Dll,就如同调用Windows api一样,Dll一般在和你的应用程序同级目录或系统目录。不过调用时可能较麻烦,因为有一些平台调用的知识。
      你可以在Msdn中找“平台调用”相关知识,在你的
    SDK\v1.1、Samples\Technologies\Interop\PlatformInvoke\Custom\CS
    目录下还有示例。http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkPlatformInvokeTutorial.asp
      

  3.   

    给你一段源代码参考如下,例中 micro900.dll 是硬件厂商提供的DLL动态链接库文件;OpenPort、ClosePort都是内置的函数,它们后面的括号里写的就是调用的参数和类型,ClosePort无参数,所以有一个空括号。
    public class Form1 : System.Windows.Forms.Form
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;
    [ DllImport( "micro900.dll" )]
    public static extern int OpenPort(string PortName,ref int PortHandle);
            [ DllImport( "micro900.dll" )]
    public static extern int ClosePort();.......使用的时候这样:result = OpenPort("COM2", ref PortHandle);
                    result = ClosePort();明白了么?
      

  4.   

    在解决方案资源管理器中--->引用--->添加引用--->.net(or com)--->浏览,选择你的DLL文件--->OK
      

  5.   

    to firestone2003 
       我引用的时候会出错!
      

  6.   

    http://www.ccw.com.cn/htm/app/aprog/01_9_14_4.aspc# 调用API
      

  7.   

    最简单方式就是引用这个dll了
      

  8.   

    我可以把我de程序给你看看!
    你de mail!!
      

  9.   

    Visual C#中运用API函数获取系统信息 
    http://www.vccode.com/file_show.php?id=1863另外csdn的文档库里面有一篇名叫"如何在C#中使用 Win32和其他库"的文章,也不错