关于Dll

wcyfz 2002-03-22 04:44:46
有这样的一个函数它的格式是这样的

function ReadRam2k(AR_ID:Integer;Buffout:String;Eof:Iinteger):Integer;.........
功能:将卡钟的条记录下载下来!
AR_ID为卡钟号;
Buffout为下载出来的数据;
Eof;是否已下载完
1,为已下载完,0,为没有!

因为那个DLL是别人做好了的,我没办法看到,我怎样才能得到Buffout的值!

我看的不太明白,还请大家指教!
...全文
137 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dragongong 2002-03-22
  • 打赏
  • 举报
回复
呵呵,给你一段VB的代码看看吧,应该就知道怎么回事了,嘿嘿程序写的很烂,不是我写的。你在自己的单元头申明调用DLL时把固定路径去掉

Option Explicit
Private Result As Long
Public AR As Long
Public flag As String
'打开串口
Private Declare Function Open_ComX Lib "d:\动态库\jbc2900.DLL" _
(ByVal ComPort As String, ByVal Baut As Long) As Long
'关闭串口
Private Declare Function Close_ComX Lib "d:\动态库\jbc2900.DLL" () As Long
'搜索卡钟
Private Declare Function SearchAR Lib "d:\动态库\jbc2900.DLL" (ByVal AR_ID As Long) As Long
'清除数据
Private Declare Function ClearRam Lib "d:\动态库\jbc2900.DLL" (ByVal AR_ID As Long) As Long
'VB读数据块到内存
Private Declare Function VBReadRam2K Lib "d:\动态库\jbc2900.DLL" _
(ByVal AR_ID As Long, ByVal BlockFlag As Long) As Long
'VB读单条数据
Private Declare Function ReadRamOne Lib "d:\动态库\jbc2900.DLL" (ByVal AR_ID As Long, ByRef RetVal As Any) As Long
'VB从内存读数据
Private Declare Function VBReadBuf Lib "d:\动态库\jbc2900.DLL" _
(buf As Buf30, ByVal dseek As Long) As Long
'设置时间参数表
Private Declare Function SetDoorTimeTable Lib "d:\动态库\jbc2900.DLL" _
(ByVal AR_ID As Long, ByVal TimeTable As String, ByVal team As Long) As Long

Private Declare Function SetARAdress Lib "d:\动态库\jbc2900.DLL" _
(ByVal AR_ID As Long, ByVal AR_NEW As Long) As Long
Private Type Buf30
A0 As Byte
A1 As Byte
A2 As Byte
A3 As Byte
A4 As Byte
A5 As Byte
A6 As Byte
A7 As Byte
A8 As Byte
A9 As Byte
A10 As Byte
A11 As Byte
A12 As Byte
A13 As Byte
A14 As Byte
A15 As Byte
A16 As Byte
A17 As Byte
A18 As Byte
A19 As Byte
A20 As Byte
A21 As Byte
A22 As Byte
A23 As Byte
A24 As Byte
A25 As Byte
A26 As Byte
A27 As Byte
'A28 As Byte
'A29 As Byte
End Type


Private Sub Command1_Click()
Dim showstring As String
Dim flage As String
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim mydate As String
Dim mytime As String
Dim mystr As String
'Dim mybuf As Buf30
Dim i As Integer
Dim disp As String
Dim a(28) As Byte
Dim cn As New ADODB.Connection
Dim rss As New ADODB.Recordset
Dim strSQL As String

On Error GoTo errHanlder
'cn.Open "driver={sql server};server=alex;uid=rainforest;pwd=happy;database=mysnoopy"
'rss.Open "select * from 开关", cn, adOpenDynamic, adLockPessimistic
'If rss("开关") = "开" Then
If Open_ComX("com2", 9600) <> 0 Then
'MsgBox "串口打开未成功!"
Exit Sub
End If
If SearchAR(1) <> 0 Then
'MsgBox "未收到卡钟"
Call Close_ComX
Exit Sub
End If
'Do Until (flag = "是")
' Call VBReadRam2K(1, 0)
If ReadRamOne(1, a(4)) = 0 Then
'mystr = a
'MsgBox mystr
'Exit Sub


'If VBReadRam2K(1, 0) <> 0 Then
' MsgBox "未读到数据!"
'End If
i = 1
Result = 1
disp = ""
'Do Until (Result = 0)
'Result = VBReadBuf(mybuf, 1)
' i = i + 1
'disp = disp & Hex(IIf(a(0) >= 65, a(0) - 55, a(0) - &H30))
'disp = disp & Hex(IIf(a(1) >= 65, a(1) - 55, a(1) - &H30))
'disp = disp & Hex(IIf(a(2) >= 65, a(2) - 55, a(2) - &H30))
'disp = disp & Hex(IIf(a(3) >= 65, a(3) - 55, a(3) - &H30))
'disp = disp & Hex(IIf(a(4) >= 65, a(4) - 55, a(4) - &H30))
disp = disp & Hex(IIf(a(21) >= 65, a(21) - 55, a(21) - &H30))
disp = disp & Hex(IIf(a(22) >= 65, a(22) - 55, a(22) - &H30))
disp = disp & Hex(IIf(a(23) >= 65, a(23) - 55, a(23) - &H30))
disp = disp & Hex(IIf(a(24) >= 65, a(24) - 55, a(24) - &H30))
disp = disp & Hex(IIf(a(25) >= 65, a(25) - 55, a(25) - &H30))
disp = disp & Hex(IIf(a(26) >= 65, a(26) - 55, a(26) - &H30))
disp = disp & Hex(IIf(a(27) >= 65, a(27) - 55, a(27) - &H30))
disp = disp & Hex(IIf(a(28) >= 65, a(28) - 55, a(28) - &H30))
'disp = disp & Hex(IIf(a(29) >= 65, a(29) - 55, a(29) - &H30))
'disp = disp & Hex(IIf(a(14) >= 65, a(14) - 55, a(30) - &H30))
'disp = disp & Hex(IIf(a(15) >= 65, a(15) - 55, a(15) - &H30))
'disp = disp & Hex(IIf(a(16) >= 65, a(16) - 55, a(16) - &H30))
' If mybuf.A0 <> 0 Then

'disp = disp & Hex(IIf(a(0) >= 65, a(0) - 55, a(0) - &H30))
'disp = disp & Hex(IIf(mybuf.A18 >= 65, mybuf.A18 - 55, mybuf.A18 - &H30))
'disp = disp & Hex(IIf(mybuf.A19 >= 65, mybuf.A19 - 55, mybuf.A19 - &H30))
'disp = disp & Hex(IIf(mybuf.A20 >= 65, mybuf.A20 - 55, mybuf.A20 - &H30))
'disp = disp & Hex(IIf(mybuf.A21 >= 65, mybuf.A21 - 55, mybuf.A21 - &H30))
'disp = disp & Hex(IIf(mybuf.A22 >= 65, mybuf.A22 - 55, mybuf.A22 - &H30))
'disp = disp & Hex(IIf(mybuf.A23 >= 65, mybuf.A23 - 55, mybuf.A23 - &H30))
'disp = disp & Hex(IIf(mybuf.A24 >= 65, mybuf.A24 - 55, mybuf.A24 - &H30))

'Else
' MsgBox "无数据显示!"
' //Exit Sub
'// End If
taber 2002-03-22
  • 打赏
  • 举报
回复
如果Buffout是传入的,那么调用这个函数时当然要指定它才能够调用,当然得到了buffout的内容;如果buffout时输出的,那么它就是一个存放的string,调用成功后直接访问它就可以了

829

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧