smart.bas
上传用户:djzm888
上传日期:2013-02-15
资源大小:867k
文件大小:3k
源码类别:

其他数据库

开发平台:

Visual Basic

  1. Attribute VB_Name = "modSmart"
  2.  Declare Function PowerOn Lib "smartdll2.dll" () As Integer
  3.  Declare Function PowerOff Lib "smartdll2.dll" () As Integer
  4.  Declare Function OpenComm Lib "smartdll2.dll" (ByVal nPort As Integer) As Integer
  5.  Declare Function CloseComm Lib "smartdll2.dll" () As Integer
  6.  Declare Function GetState Lib "smartdll2.dll" (ByVal nPort As Integer) As Integer
  7.  Declare Function IC_ATR Lib "smartdll2.dll" (ByVal DataBuffer As String) As Integer
  8.  Declare Function IC_ReadMain Lib "smartdll2.dll" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer
  9.  Declare Function IC_ReadProtect Lib "smartdll2.dll" (ByVal DataBuffer As String) As Integer
  10.  Declare Function IC_ReadSecurity Lib "smartdll2.dll" (ByVal DataBuffer As String) As Integer
  11.  Declare Function IC_ReadErrorCount Lib "smartdll2.dll" () As Integer
  12.  Declare Function IC_WriteMain Lib "smartdll2.dll" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer
  13.  Declare Function IC_WriteProtect Lib "smartdll2.dll" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer
  14.  Declare Function IC_UpdateSM Lib "smartdll2.dll" (ByVal Offset As Integer, ByVal Length As Integer, ByVal DataBuffer As String) As Integer
  15.  Declare Function IC_ChangePass Lib "smartdll2.dll" (ByVal PassWord As String) As Integer
  16.  Declare Function IC_PSCCheck Lib "smartdll2.dll" (ByVal DataBuffer As String) As Integer
  17.  Declare Function CardExist Lib "smartdll2.dll" () As Integer
  18.  
  19.  Declare Function POS_IsReady Lib "smartdll2.dll" (ByVal nPosAddr As Byte) As Integer
  20.  Declare Function POS_GetTime Lib "smartdll2.dll" (ByVal nPosAddr As Byte, ByVal strTime As String) As Integer
  21.  Declare Function POS_SetTime Lib "smartdll2.dll" (ByVal nPosAddr As Byte, ByVal strTime As String) As Integer
  22.  Declare Function POS_GetNextFrame Lib "smartdll2.dll" (ByVal nPosAddr As Byte, ByVal strFrame As String) As Integer
  23.  Declare Function POS_GetFrameAgain Lib "smartdll2.dll" (ByVal nPosAddr As Byte, ByVal strFrame As String) As Integer
  24.  Declare Function POS_SetRecordCount Lib "smartdll2.dll" (ByVal nPosAddr As Byte, ByVal nRecordCount As Integer) As Integer
  25.  
  26.  Declare Function ReadDot Lib "smartdll2.dll" (ByVal nCode As Integer, ByVal strDot As String) As Integer
  27.  Public Const dwOffset = &H40
  28.  Public Const dwLength = 13
  29.  Public Const dwNameOffset = &H80
  30.  Public Const dwNameLength = 96
  31.  
  32. Function KeyFilter(KeyAscii As Integer, Optional isDigital As Boolean = False) As Integer
  33.     
  34.     If isDigital Then
  35.         Select Case KeyAscii
  36.            Case Asc("0") To Asc("9"), Asc("a") To Asc("f"), Asc("A") To Asc("F"), vbKeyBack, vbKeyLButton, vbKeyRButton, vbKeyTab, vbKeyReturn
  37.                 KeyFilter = KeyAscii
  38.                 Exit Function
  39.            Case Else
  40.              KeyFilter = 7 'beep
  41.         End Select
  42.     Else
  43.         Select Case KeyAscii
  44.            Case Asc("0") To Asc("9"), Asc("a") To Asc("z"), Asc("A") To Asc("Z"), vbKeyBack, vbKeyLButton, vbKeyRButton, vbKeyTab, vbKeyReturn
  45.                 KeyFilter = KeyAscii
  46.                 Exit Function
  47.            Case Else
  48.              KeyFilter = 7 'beep
  49.         End Select
  50.     End If
  51. End Function
  52. Function CharToNum(inChar As String) As Byte
  53.     Select Case UCase(inChar)
  54.         Case "0" To "9": CharToNum = CByte(inChar)
  55.         Case "A" To "F": CharToNum = Asc(UCase(inChar)) - 55
  56.         Case Else:       CharToNum = 0
  57.     End Select
  58. End Function