⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmsb.frm

📁 社保卡信息读取 使用读卡器对社保卡信息读取,联通公司使用的代码,对硬件控制学习有所帮助吧
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Caption         =   "公民身份号码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   285
      Index           =   10
      Left            =   120
      TabIndex        =   6
      Top             =   4200
      Width           =   1845
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "民族"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   285
      Index           =   3
      Left            =   360
      TabIndex        =   5
      Top             =   2280
      Width           =   630
   End
End
Attribute VB_Name = "frmsb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub displaydata()
Dim Rtn

Text1(10) = Data_A(0)
Text1(7) = Data_A(1)
Text1(0) = Data_A(2)
Text1(1) = Data_A(3)
Text1(2) = Data_A(4)
Text1(4) = Data_A(5)


Text1(2) = DisplayNation(Text1(2))
Text1(1) = GetSex(Val(Text1(1)))
'Rtn = SetWindowPos(frmsb.hwnd, -1, 0, 0, 0, 0, 3)
End Sub

'性别分析
Public Function GetSex(ByVal SexID As Integer) As String
    Select Case SexID
        Case 0
            GetSex = "不明性别"
        Case 1
            GetSex = "男"
        Case 2
            GetSex = "女"
        Case 9
            GetSex = "未说明"
    End Select
End Function



'民族分析

Public Function DisplayNation(ByVal Nation_code As String) As String


Select Case Nation_code
    Case "01": DisplayNation = "汉族"
    Case "02": DisplayNation = "蒙古族"
    Case "03": DisplayNation = "回族"
    Case "04": DisplayNation = "藏族"
    Case "05": DisplayNation = "维吾尔族"
    Case "06": DisplayNation = "苗族"
    Case "07": DisplayNation = "彝族"
    Case "08": DisplayNation = "壮族"
    Case "09": DisplayNation = "布依族"
    Case "10": DisplayNation = "朝鲜族"
    Case "11": DisplayNation = "满族"
    Case "12": DisplayNation = "侗族"
    Case "13": DisplayNation = "瑶族"
    Case "14": DisplayNation = "白族"
    Case "15": DisplayNation = "土家族"
    Case "16": DisplayNation = "哈尼族"
    Case "17": DisplayNation = "哈萨克族"
    Case "18": DisplayNation = "傣族"
    Case "19": DisplayNation = "黎族"
    Case "20": DisplayNation = "傈僳族"
    Case "21": DisplayNation = "佤族"
    Case "22": DisplayNation = "畲族"
    Case "23": DisplayNation = "高山族"
    Case "24": DisplayNation = "拉祜族"
    Case "25": DisplayNation = "水族"
    Case "26": DisplayNation = "东乡族"
    Case "27": DisplayNation = "纳西族"
    Case "28": DisplayNation = "景颇族"
    Case "29": DisplayNation = "柯尔克孜族"
    Case "30": DisplayNation = "土族"
    Case "31": DisplayNation = "达斡尔族"
    Case "32": DisplayNation = "仫佬族"
    Case "33": DisplayNation = "羌族"
    Case "34": DisplayNation = "布朗族"
    Case "35": DisplayNation = "撒拉族"
    Case "36": DisplayNation = "毛难族"
    Case "37": DisplayNation = "仡佬族"
    Case "38": DisplayNation = "锡伯族"
    Case "39": DisplayNation = "阿昌族"
    Case "40": DisplayNation = "普米族"
    Case "41": DisplayNation = "塔吉克族"
    Case "42": DisplayNation = "怒族"
    Case "43": DisplayNation = "乌孜别克族"
    Case "44": DisplayNation = "俄罗斯族"
    Case "45": DisplayNation = "鄂温克族"
    Case "46": DisplayNation = "崩龙族"
    Case "47": DisplayNation = "保安族"
    Case "48": DisplayNation = "裕固族"
    Case "49": DisplayNation = "京族"
    Case "50": DisplayNation = "塔塔尔族"
    Case "51": DisplayNation = "独龙族"
    Case "52": DisplayNation = "鄂伦春族"
    Case "53": DisplayNation = "赫哲族"
    Case "54": DisplayNation = "门巴族"
    Case "55": DisplayNation = "珞巴族"
    Case "56": DisplayNation = "基诺族"
    Case "97": DisplayNation = "其它"
    Case "98": DisplayNation = "外国血统"
    Case Else: DisplayNation = "不详"
End Select
End Function
''  本地读取IC卡函数部分


'打开串口
 Private Sub cmdOpen()
    If Not PortOpened Then
        fd = ICC_Reader_Open(Trim(Combo1.Text))
        PortOpened = True
        If fd < 0 Then
             MsgBox "串口已经被打开"
            'List_Error.Show
            Exit Sub
        Else
            PortOpened = True
        End If
    End If
End Sub


'关闭串口
Private Sub cmdClose()
    If PortOpened Then
        ICC_Reader_Close (fd)
        PortOpened = False
    End If

End Sub


'上电
Private Sub cmdPowerOn()
    Dim ret As Long
    Dim resp(0 To 255) As Byte
    ret = ICC_Reader_InsertCard(fd, ICC_CONNECTOR_USER, ICC_T0, 32, resp(0))
    If ret < 0 Then
        MsgBox "ATR fail"
   
    End If
    
End Sub


'下电
Private Sub cmdPowerOff()
    ICC_Reader_RemoveCard fd, ICC_CONNECTOR_USER, 0
End Sub


'选择 MF_DF
Private Function Switch(Handel As String) As Long
    Dim mf_df As String
    Dim ret As Long
    Dim errmsg As String
    mf_df = Handel + vbNullChar
    errmsg = Space(256)
    If Handel = "DF08" Then
        ret = switch_service(fd, mf_df, AUTH_READ + AUTH_WRITE, errmsg)
    Else
        ret = switch_service(fd, mf_df, 0, errmsg)
    End If
    
    If ret < 0 Then
        MsgBox errmsg

    End If
    Switch = ret
End Function


'读取数据
Private Function ReadRec(ef As String, recno As String, transform As String) As Long
    Dim ret As Long
    Dim EF1 As String
    Dim RecNo1 As Long
    Dim data As String
    Dim tf As Long
    Dim errmsg As String
    EF1 = ef
    RecNo1 = CInt(recno)
    data = Space(256)
    
    tf = -1
    Select Case transform
        Case "CN": tf = TF_CN
        Case "AN": tf = TF_AN
        Case "BIN": tf = TF_BIN
    End Select
    If tf = -1 Then
        MsgBox "Error set TransForm"
        Exit Function
    End If
    
    
    errmsg = Space(256)
    ret = read_record(fd, EF1, RecNo1, data, tf, errmsg)
    If ret < 0 Then
         Data_A(Count_No) = ""
         
    Else
        Data_A(Count_No) = data
    End If
    
    Count_No = Count_No + 1
    ReadRec = ret
End Function
'MF GET DATA
Private Sub MF_Get_Data()
If Not PortOpened Then
         cmdOpen
End If
Count_No = 0
Dim ret As Long
ret = Switch("MF")
If ret < 0 Then
   Command5_Click
   ICC_Reader_RemoveCard fd, ICC_CONNECTOR_USER, 0
    cmdClose
   Exit Sub
End If

'EFO5 数据进库(发卡机关数据)
ret = ReadRec("EF05", "07", "AN")

'EF06 数据进库(个人基本信息)
ret = ReadRec("EF06", "01", "AN")
ret = ReadRec("EF06", "02", "AN")
ret = ReadRec("EF06", "03", "AN")
ret = ReadRec("EF06", "04", "CN")
ret = ReadRec("EF06", "06", "CN")

''EF07 数据进库(指纹信息)

'DF01 GET data

ret = Switch("DF01")

'EFO5 数据进库(户籍信息)
ret = ReadRec("EF05", "02", "AN")
ret = ReadRec("EF05", "04", "CN")

'EF06 数据进库(通讯信息)
ret = ReadRec("EF06", "04", "AN")

'EF08 数据进库(婚姻状况信息)
ret = ReadRec("EF08", "01", "AN")

'EFO9
ret = ReadRec("EF09", "01", "AN")


    ICC_Reader_RemoveCard fd, ICC_CONNECTOR_USER, 0
    cmdClose
If ret < 0 Then
   Command5_Click
   Exit Sub
End If
displaydata
End Sub





Private Sub Command22_Click()
Form1.Show
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_Click()
MF_Get_Data
End Sub

Private Sub Command5_Click()
Text1(10) = ""
Text1(7) = ""
Text1(0) = ""
Text1(1) = ""
Text1(2) = ""
Text1(4) = ""
End Sub

Private Sub Form_Load()

End Sub

Private Sub Label1_Click()
MsgBox "gaox001  gsm478"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -