M
monkeyboys
Unregistered / Unconfirmed
GUEST, unregistred user!
Attribute VB_Name = "comsubs"<br>Option Explicit<br><br>Type CardStruct<br> cardtype As Byte <br> HotelID(2) As Byte <br> AreaID As Byte <br> FloorID As Byte <br> roomid As Byte <br> CardID As Byte <br> OffOn As Byte <br> SDate(4) As Byte <br> EDate(4) As Byte <br> STiem(1) As Byte <br> ETime(1) As Byte <br> FloorCot As Byte <br>End Type<br><br><br>Public Const INVALID_HANDLE_VALUE = -1<br>Public commhandle As Long<br>Public FKQstatus As Boolean<br><br><br>Public Const CardOk As Integer = 0<br>Public Const CardErr As Integer = 1<br><br>Public RdCard As CardStruct<br>Public icdev As Long <br>Dim st As Integer <br><br>Public Declare Function auto_init Lib "comdll.dll" (ByVal CommPort As Long, ByVal Baud As Long) As Long <br>Public Declare Function ic_exit Lib "comdll.dll" (ByRef commhandle As Long) As Long <br>Public Declare Function csc4150hex Lib "comdll.dll" (ByVal commhandle As Long, ByRef keystr As Byte) As Long<br><br>Public Declare Function RDKEYRF Lib "comdll.dll" (ByVal commhandle As Long, ByRef keyinfo As Byte) As Long<br>Public Declare Function WRKEYRF Lib "comdll.dll" (ByVal commhandle As Long, ByRef keyinfo As Byte) As Long<br><br><br>Function OpenIcDev(port As Integer) As Integer<br>Dim temp As Integer<br> icdev = auto_init(port, 9600)<br><br>End Function<br><br><br>Function CloseIcDev()<br> st = ic_exit(icdev)<br>End Function<br><br><br>Function PassIcDev() As Integer<br>Dim keystr(3) As Byte<br>keystr(0) = &H1<br>keystr(1) = &H2<br>keystr(2) = &H2<br>keystr(3) = &H24<br>st = csc4150hex(icdev, keystr(0))<br>Exit Function<br>End Function<br><br><br>Function WtCardICdev(CardIn As CardStruct) As Integer<br>Dim offset As Integer<br>Dim length As Integer<br>Dim i As Integer<br>st = WRKEYRF(icdev, CardIn.cardtype)<br>If st <> 0 Then<br> WtCardICdev = CardErr<br>Else<br> WtCardICdev = CardOk<br>End If<br><br>End Function<br><br><br><br>Function RdCardICdev() As Integer<br>Dim offset As Integer<br>Dim length As Integer<br>st = RDKEYRF(icdev, RdCard.cardtype)<br>If st <> 0 Then<br> RdCardICdev = CardErr<br> Exit Function<br>Else<br> RdCardICdev = CardOk<br>End If<br><br>End Function<br><br>本人对VB确实不懂,有劳各位高手将以上代码转译为DELPHI<br>测试通过,立即给分.