📄 form1.frm
字号:
VERSION 5.00
Object = "{4941FC79-1F28-4ABC-ABBE-C5F9DD64C2CA}#1.0#0"; "OPTFIN~1.OCX"
Begin VB.Form Form1
Caption = "OCX测试程序"
ClientHeight = 7740
ClientLeft = 60
ClientTop = 345
ClientWidth = 6675
LinkTopic = "Form1"
ScaleHeight = 7740
ScaleWidth = 6675
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "服务器端验证函数测试"
Height = 1215
Left = 120
TabIndex = 16
Top = 6360
Width = 6135
Begin VB.CommandButton Command2
Caption = "MatchFingerByStr"
Height = 375
Left = 3840
TabIndex = 20
Top = 720
Width = 2055
End
Begin VB.CommandButton GetClientTz1
Caption = "获取客户端特征1"
Height = 375
Left = 120
TabIndex = 19
Top = 360
Width = 1575
End
Begin VB.CommandButton GetClientTz2
Caption = "获取客户端特征2"
Height = 375
Left = 1800
TabIndex = 18
Top = 360
Width = 1575
End
Begin VB.CommandButton ServerVerify
Caption = "服务器端比对函数"
Height = 375
Left = 3840
TabIndex = 17
Top = 240
Width = 2055
End
End
Begin VB.CommandButton Command1
Caption = "ClientValue属性"
Height = 375
Left = 4560
TabIndex = 15
Top = 4920
Width = 1575
End
Begin VB.Frame Frame1
Caption = "组合测试"
Height = 855
Left = 120
TabIndex = 11
Top = 5280
Width = 6135
Begin VB.CommandButton Match1and2
Caption = "比对指纹特征1和2"
Height = 375
Left = 3480
TabIndex = 14
Top = 360
Width = 2055
End
Begin VB.CommandButton GetTZ2
Caption = "获取指纹特征2"
Height = 375
Left = 1800
TabIndex = 13
Top = 360
Width = 1455
End
Begin VB.CommandButton GetTZ1
Caption = "获取指纹特征1"
Height = 375
Left = 240
TabIndex = 12
Top = 360
Width = 1455
End
End
Begin VB.CommandButton MatchFinger
Caption = "MatchFinger"
Height = 375
Left = 4560
TabIndex = 10
Top = 4440
Width = 1695
End
Begin VB.CommandButton SetFingerImage
Caption = "SetFingerImage"
Height = 375
Left = 4560
TabIndex = 9
Top = 3480
Width = 1695
End
Begin VB.CommandButton GetClientFinger
Caption = "GetClientFinger"
Height = 375
Left = 4560
TabIndex = 8
Top = 3960
Width = 1695
End
Begin VB.CommandButton GetFingerValue
Caption = "GetFingerValue"
Height = 375
Left = 4560
TabIndex = 7
Top = 2520
Width = 1695
End
Begin VB.CommandButton ScanFinger
Caption = "ScanFinger"
Height = 375
Left = 4560
TabIndex = 6
Top = 2040
Width = 1695
End
Begin VB.CommandButton getEquipmentModal
Caption = "getEquipmentModal"
Height = 375
Left = 4560
TabIndex = 5
Top = 1560
Width = 1695
End
Begin VB.CommandButton getSerialSize
Caption = "getSerialSize"
Height = 375
Left = 4560
TabIndex = 4
Top = 1080
Width = 1695
End
Begin VB.CommandButton OpenHardware
Caption = "OpenHardware"
Height = 375
Left = 4560
TabIndex = 3
Top = 120
Width = 1695
End
Begin VB.CommandButton GetFingerImage
Caption = "GetFingerImage"
Height = 375
Left = 4560
TabIndex = 2
Top = 3000
Width = 1695
End
Begin VB.CommandButton CloseHardware
Caption = "CloseHardware"
Height = 375
Left = 4560
TabIndex = 1
Top = 600
Width = 1695
End
Begin OPTFINGERLib.OptFinger OptFinger1
Height = 4965
Left = 120
TabIndex = 0
Top = 120
Width = 4125
_Version = 65536
_ExtentX = 7276
_ExtentY = 8758
_StockProps = 0
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim vrImg As Variant
Dim Tz1, Tz2 As Variant
Dim ClientTz1, ClientTz2 As String
Private Sub Command1_Click()
MsgBox OptFinger1.ClientValue
End Sub
Private Sub Command4_Click()
End Sub
Private Sub Command2_Click()
Dim ret As Boolean
If (ClientTz1 = Empty Or ClientTz2 = Empty) Then
MsgBox ("你要先录入特征,才能比对")
Exit Sub
End If
ret = OptFinger1.MatchFingerByStr(ClientTz1, ClientTz2, 5)
If (ret) Then
MsgBox "比对通过"
Else
MsgBox "比对没有通过"
End If
End Sub
Private Sub Form_Load()
Dim ret As Boolean
ret = OptFinger1.OpenHardware
If (ret = False) Then
MsgBox "打开设备失败"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
OptFinger1.CloseHardware
End Sub
Private Sub GetClientFinger_Click()
Dim str As Variant
str = OptFinger1.GetClientFinger
MsgBox str
End Sub
Private Sub GetClientTz1_Click()
Dim ret As Boolean
Dim vr As Variant
ret = OptFinger1.ScanFinger(vr)
If (ret = False) Then
MsgBox ("获取指纹错误")
End
End If
ClientTz1 = OptFinger1.GetClientFinger()
End Sub
Private Sub GetClientTz2_Click()
Dim ret As Boolean
Dim vr As Variant
ret = OptFinger1.ScanFinger(vr)
If (ret = False) Then
MsgBox ("获取指纹错误")
End
End If
ClientTz2 = OptFinger1.GetClientFinger()
End Sub
Private Sub GetFingerImage_Click()
Dim ret As Boolean
ret = OptFinger1.GetFingerImage(vrImg)
If (ret) Then
MsgBox "成功"
Else
MsgBox "失败"
End If
End Sub
Private Sub GetFingerValue_Click()
Dim vr As Variant
Dim ret As Boolean
ret = OptFinger1.GetFingerValue(vr)
If (ret) Then
MsgBox "成功"
Else
MsgBox "失败"
End If
End Sub
Private Sub GetTZ1_Click()
Dim ret As Boolean
Dim vr As Variant
ret = OptFinger1.ScanFinger(vr)
If (ret = False) Then
MsgBox ("获取指纹错误")
End
End If
ret = OptFinger1.GetFingerValue(Tz1)
If (ret) Then
MsgBox "特征获取成功"
Else
MsgBox "特征获取失败"
End If
End Sub
Private Sub GetTZ2_Click()
Dim ret As Boolean
Dim vr As Variant
ret = OptFinger1.ScanFinger(vr)
If (ret = False) Then
MsgBox ("获取指纹错误")
Exit Sub
End If
ret = OptFinger1.GetFingerValue(Tz2)
If (ret) Then
MsgBox "特征获取成功"
Else
MsgBox "特征获取失败"
End If
End Sub
Private Sub Match1and2_Click()
Dim ret As Boolean
If (Tz1 = Empty Or Tz2 = Empty) Then
MsgBox ("你要先录入特征,才能比对")
Exit Sub
End If
ret = OptFinger1.MatchFinger(Tz1, Tz2, 5)
If (ret) Then
MsgBox "比对通过"
Else
MsgBox "比对没有通过"
End If
End Sub
Private Sub MatchFinger_Click()
MsgBox "这里只是一个调用示例,因为需要传递特征值,具体可以参照下面的组合指令"
Exit Sub
Dim ret As Boolean
Dim vr1, vr2 As Variant
Dim Level As Integer
Level = 5
ret = OptFinger1.MatchFinger(vr1, vr2, Level)
If (ret) Then
MsgBox "成功"
Else
MsgBox "失败"
End If
End Sub
Private Sub OpenHardware_Click()
Dim ret As Boolean
ret = OptFinger1.OpenHardware
If (ret = False) Then
MsgBox "打开设备失败"
End If
End Sub
Private Sub CloseHardware_Click()
OptFinger1.CloseHardware
End Sub
Private Sub getEquipmentModal_Click()
Dim str As String
str = OptFinger1.getEquipmentModal
MsgBox "设备型号是:" + str
End Sub
Private Sub getSerialSize_Click()
Dim str As String
str = OptFinger1.getSerialSize
MsgBox "设备序列号是:" + str
End Sub
Private Sub ScanFinger_Click()
Dim vr As Variant
Dim ret As Boolean
ret = OptFinger1.ScanFinger(vr)
If (ret) Then
MsgBox "成功"
Else
MsgBox "失败"
End If
End Sub
'服务器端验证函数,函数声明在Module1中,
'此处名称不用MatchFinger的原因是Ocx中也有同样的函数,在同一个工程中导致执行失败
Private Sub ServerVerify_Click()
Dim ret As Boolean
If (ClientTz1 = "" Or ClientTz2 = "") Then
MsgBox "请录入特征"
Exit Sub
End If
ret = Server_MatchFinger(ClientTz1, ClientTz2, 5)
If (ret) Then
MsgBox "验证通过"
Else
MsgBox "验证失败"
End If
End Sub
Private Sub SetFingerImage_Click()
Dim ret As Boolean
If (vrImg = Empty) Then
MsgBox "你要先获取图像"
Exit Sub
End If
ret = OptFinger1.SetFingerImage(vrImg)
If (ret) Then
MsgBox "成功"
Else
MsgBox "失败"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -