WINFORM如何调用.DLL的函数.给我了一个READCARD.DLL并给了说明,每个函数和参数代表了什么.
现在要做串口通讯程序.如何调用DLL中的函数.

解决方案 »

  1.   

    添加引用,或者使用assembly反射。
      

  2.   

    READCARD.DLL这样的DLL,一般估计是C或C++写,应该使用DLLIMPORT
      

  3.   

    两种方式:
    1、引用DLL
    2、通过如下方法:
     [DllImport("user32", EntryPoint = "SendMessageA")]
            public static extern int SendMessage(int Hwnd, int wMsg, int wParam, ref COPYDATASTRUCT lParam);
      

  4.   

    [DllImport("user32", EntryPoint = "SendMessageA")]
      public static extern int SendMessage(int Hwnd, int wMsg, int wParam, ref COPYDATASTRUCT lParam);
    添加命名空间引用:using System.RunTime.InterPort;什么的。
      

  5.   

    DllImport
    public static extern ..
    说明就应该有介绍
      

  6.   

    1.引入命名空间
    using System.Runtime.InteropServices
    2.写调用的方法
     [DllImport("READCARD.DLL", EntryPoint = "STK_DownLoadList")]
            private static extern int STK_DownLoadList(参数);就这样OK啊!
      

  7.   

    为什么我引用using System.Runtime.InteropServices;之后没有 DllImport 只有 DllImportAttribute 呢?
      

  8.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    这样引用有问题吗?