'function ReadIcCard(ComName:Pchar;out sIcNo, sEmpNo, sEmpName, sEmpSex, sPassword,
'    sEmpUnitName, sEmpRylb, sEmpQxh, InHosp, HospCode: shortstring;
'    var intHospNum, intOldYear: integer;
'    var curNNTcyz, curNNDEYZ, curMTYZ, GZYE, MZQFLJ: Double): integer; export;
'上面是delphi写的DLL函数定义原形,在VB里面怎么定义啊?? 
'注意:不要说DLL有问题,因为已经有人使用了.哈哈
'下面是我写的没有成功Private Declare Function ReadIcCard Lib "HospPolicy.dll" (ByVal ComName As String, ByRef sIcNo As String, _
  ByRef sEmpNo As String, ByRef sEmpName As String, ByRef sEmpSex As String, ByRef sPassWord As String, _
  ByRef sEmpUnitName As String, ByRef sEmpRylb As String, ByRef sEmpQxh As String, ByRef InHosp As String, _
  ByRef HospCode As String, ByRef intHospNum As Integer, ByRef intOldYear As Integer, ByRef curNNTcyz As Double, _
  ByRef curNNDEYZ As Double, ByRef curMTYZ As Double, ByRef GZYE As Double, ByRef MZQFLJ As Double) As LongPrivate Sub Command1_Click()
  Dim ichandle As Long
  Dim ComName As String
  Dim sIcNo As String
  Dim sEmpNo As String
  Dim sEmpName As String
  Dim sEmpSex As String
  Dim sPassWord As String
  Dim sEmpUnitName As String
  Dim sEmpRylb As String
  Dim sEmpQxh As String
  Dim InHosp As String
  Dim HospCode As String  Dim intHospNum, intOldYear As Integer
  Dim curNNTcyz, curNNDEYZ, curMTYZ, GZYE, MZQFLJ As Double
  
  ComName = "COM1"
  ichandle = ReadIcCard(ComName, sIcNo, sEmpNo, sEmpName, sEmpSex, _
     sPassWord, sEmpUnitName, sEmpRylb, sEmpQxh, InHosp, HospCode, _
     intHospNum, intOldYear, curNNTcyz, curNNDEYZ, curMTYZ, GZYE, MZQFLJ)
  If ichandle = 0 Then
      MsgBox ("NOT")
   End If
   End Sub

解决方案 »

  1.   

    Private Declare Function ReadIcCard Lib "HospPolicy.dll" (ByVal ComName As String, ByRef sIcNo As String, _
      ByRef sEmpNo As String, ByRef sEmpName As String, ByRef sEmpSex As String, ByRef sPassWord As String, _
      ByRef sEmpUnitName As String, ByRef sEmpRylb As String, ByRef sEmpQxh As String, ByRef InHosp As String, _
      ByRef HospCode As String, ByVal intHospNum As Integer, ByVal intOldYear As Integer, ByRef curNNTcyz As Double, _
      ByVal curNNDEYZ As Double, ByVal curMTYZ As Double, ByVal GZYE As Double, ByVal MZQFLJ As Double) As Integer
      

  2.   

    'function ReadIcCard(ComName:Pchar;out sIcNo, sEmpNo, sEmpName, sEmpSex, sPassword,
    '    sEmpUnitName, sEmpRylb, sEmpQxh, InHosp, HospCode: shortstring;
    '    var intHospNum, intOldYear: integer;
    '    var curNNTcyz, curNNDEYZ, curMTYZ, GZYE, MZQFLJ: Double): integer; export;
    Private Declare Function ReadIcCard Lib "HospPolicy.dll" (ByVal ComName As String, ByRef sIcNo As String, _
      ByRef sEmpNo As String, ByRef sEmpName As String, ByRef sEmpSex As String, ByRef sPassWord As String, _
      ByRef sEmpUnitName As String, ByRef sEmpRylb As String, ByRef sEmpQxh As String, ByRef InHosp As String, _
      ByRef HospCode As String, ByRef intHospNum As Integer, ByRef intOldYear As Integer, ByRef curNNTcyz As Double, _
      ByRef curNNDEYZ As Double, ByRef curMTYZ As Double, ByRef GZYE As Double, ByRef MZQFLJ As Double) As Integer
    Private Sub Command1_Click()
      Dim ichandle As Integer
      Dim ComName As String
      Dim sIcNo(255) As String
      Dim sEmpNo(255) As String
      Dim sEmpName(255) As String
      Dim sEmpSex(255) As String
      Dim sPassWord(255) As String
      Dim sEmpUnitName(255) As String
      Dim sEmpRylb(255) As String
      Dim sEmpQxh(255) As String
      Dim InHosp(255) As String
      Dim HospCode(255) As String  Dim intHospNum As Integer
      Dim intOldYear As Integer
      
      Dim curNNTcyz As Double
      Dim curNNDEYZ As Double
      Dim curMTYZ  As Double
      Dim GZYE As Double
      Dim MZQFLJ As Double
      
      ComName = "COM1"
      
      ichandle = ReadIcCard(ByVal ComName, sIcNo(0), sEmpNo(0), sEmpName(0), sEmpSex(0), _
         sPassWord(0), sEmpUnitName(0), sEmpRylb(0), sEmpQxh(0), InHosp(0), HospCode(0), _
         intHospNum, intOldYear, curNNTcyz, curNNDEYZ, curMTYZ, GZYE, MZQFLJ)
      If ichandle = 0 Then
          MsgBox ("NOT")
       End If
       End Sub
    ---------------------------
    工程1: 工程1.exe - 应用程序错误
    ---------------------------
    "0x779b953b" 指令引用的 "0x3138392c" 内存。该内存不能为 "read"。
    要终止程序,请单击“确定”。
    要调试程序,请单击“取消”。
    ---------------------------
    确定   取消   
    ---------------------------
    提示上面的错误!!晕啊