📄 frmoption.frm
字号:
TabIndex = 11
Top = 1320
Width = 450
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "秒(s)"
Height = 180
Left = 3240
TabIndex = 9
Top = 840
Width = 450
End
Begin VB.Label lblRangeTo
AutoSize = -1 'True
Caption = "到 Ezusb-"
Height = 180
Left = 3240
TabIndex = 6
Top = 405
Width = 810
End
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 3840
TabIndex = 1
Top = 4320
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 5160
TabIndex = 0
Top = 4320
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Height = 45
Left = 135
TabIndex = 2
Top = 4200
Width = 6495
End
End
Attribute VB_Name = "frmOption"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CommandButton1_Click()
End Sub
Private Sub cmdCancel_Click()
frmOption.Hide
Unload frmOption
End Sub
Private Sub cmdDefault_Click()
txtDevFrom.Text = "0"
txtDevTo.Text = CStr(MAX_USB_DEV_NUMBER)
txtDetachDelay.Text = "2"
txtPluginDelay.Text = "30"
txtTransDelay.Text = "100"
txtDogDelay.Text = "800"
txtRetryTimes.Text = "5"
End Sub
Private Sub cmdOk_Click()
' 1. set Fields to Option Variables
optLngDevFrom = CLng(txtDevFrom.Text)
optLngDevTo = CLng(txtDevTo.Text)
optLngDetachDelay = CLng(txtDetachDelay.Text)
optLngPluginDelay = CLng(txtPluginDelay.Text)
frmMain.ezlibObj.DeviceDetachTimeout = optLngDetachDelay
frmMain.ezlibObj.RunChipDelay = optLngPluginDelay
optLngTransDelay = CLng(txtTransDelay.Text)
optLngDogDelay = CLng(txtDogDelay.Text)
optLngRetryTimes = CLng(txtRetryTimes.Text)
' 2. Write Option Variables to File
Call procSaveOptions
' 3. Reload Option Variables From File
Call procLoadOptions
frmOption.Hide
Unload frmOption
End Sub
Private Sub Form_Load()
Call procInitFields
End Sub
Private Sub procInitFields()
txtDevFrom.Text = CStr(optLngDevFrom)
txtDevTo.Text = CStr(optLngDevTo)
txtDetachDelay.Text = CStr(optLngDetachDelay)
txtPluginDelay.Text = CStr(optLngPluginDelay)
txtTransDelay.Text = CStr(optLngTransDelay)
txtDogDelay.Text = CStr(optLngDogDelay)
txtRetryTimes.Text = CStr(optLngRetryTimes)
End Sub
Private Sub txtDetachDelay_Change()
On Error GoTo FixHandle
updDetachDelay.Value = CLng(txtDetachDelay.Text)
Exit Sub
FixHandle:
If Len(Trim(txtDetachDelay.Text)) = 0 Then
txtDetachDelay.Text = updDetachDelay.Min
ElseIf CLng(txtDetachDelay.Text) > updDetachDelay.Max Then
txtDetachDelay.Text = updDetachDelay.Max
ElseIf CLng(txtDetachDelay.Text) < updDetachDelay.Min Then
txtDetachDelay.Text = updDetachDelay.Min
End If
End Sub
Private Sub txtDetachDelay_GotFocus()
txtDetachDelay.SelStart = 0
txtDetachDelay.SelLength = Len(txtDetachDelay.Text)
End Sub
Private Sub txtDetachDelay_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtDevFrom_Change()
On Error GoTo FixHandle
updDevFrom.Value = CLng(txtDevFrom.Text)
updDevTo.Min = updDevFrom.Value
Exit Sub
FixHandle:
If Len(Trim(txtDevFrom.Text)) = 0 Then
txtDevFrom.Text = updDevFrom.Min
ElseIf CLng(txtDevFrom.Text) > updDevFrom.Max Then
txtDevFrom.Text = updDevFrom.Max
ElseIf CLng(txtDevFrom.Text) < updDevFrom.Min Then
txtDevFrom.Text = updDevFrom.Min
End If
End Sub
Private Sub txtDevFrom_GotFocus()
txtDevFrom.SelStart = 0
txtDevFrom.SelLength = Len(txtDevFrom.Text)
End Sub
Private Sub txtDevFrom_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtDevTo_Change()
On Error GoTo FixHandle
updDevTo.Value = CLng(txtDevTo.Text)
Exit Sub
FixHandle:
If Len(Trim(txtDevTo.Text)) = 0 Then
txtDevTo.Text = updDevTo.Min
ElseIf CLng(txtDevTo.Text) > updDevTo.Max Then
txtDevTo.Text = updDevTo.Max
ElseIf CLng(txtDevTo.Text) < updDevTo.Min Then
txtDevTo.Text = updDevTo.Min
End If
End Sub
Private Sub txtDevTo_GotFocus()
txtDevTo.SelStart = 0
txtDevTo.SelLength = Len(txtDevTo.Text)
End Sub
Private Sub txtDevTo_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtDogDelay_Change()
On Error GoTo FixHandle
updDogDelay.Value = CLng(txtDogDelay.Text)
Exit Sub
FixHandle:
If Len(Trim(txtDogDelay.Text)) = 0 Then
txtDogDelay.Text = updDogDelay.Min
ElseIf CLng(txtDogDelay.Text) > updDogDelay.Max Then
txtDogDelay.Text = updDogDelay.Max
ElseIf CLng(txtDogDelay.Text) < updDogDelay.Min Then
txtDogDelay.Text = updDogDelay.Min
End If
End Sub
Private Sub txtDogDelay_GotFocus()
txtDogDelay.SelStart = 0
txtDogDelay.SelLength = Len(txtDogDelay.Text)
End Sub
Private Sub txtDogDelay_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtPluginDelay_Change()
On Error GoTo FixHandle
updPluginDelay.Value = CLng(txtPluginDelay.Text)
Exit Sub
FixHandle:
If Len(Trim(txtPluginDelay.Text)) = 0 Then
txtPluginDelay.Text = updPluginDelay.Min
ElseIf CLng(txtPluginDelay.Text) > updPluginDelay.Max Then
txtPluginDelay.Text = updPluginDelay.Max
ElseIf CLng(txtPluginDelay.Text) < updPluginDelay.Min Then
txtPluginDelay.Text = updPluginDelay.Min
End If
End Sub
Private Sub txtPluginDelay_GotFocus()
txtPluginDelay.SelStart = 0
txtPluginDelay.SelLength = Len(txtPluginDelay.Text)
End Sub
Private Sub txtPluginDelay_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtRetryTimes_Change()
On Error GoTo FixHandle
updRetryTimes.Value = CLng(txtRetryTimes.Text)
Exit Sub
FixHandle:
If Len(Trim(txtRetryTimes.Text)) = 0 Then
txtRetryTimes.Text = updRetryTimes.Min
ElseIf CLng(txtRetryTimes.Text) > updRetryTimes.Max Then
txtRetryTimes.Text = updRetryTimes.Max
ElseIf CLng(txtRetryTimes.Text) < updRetryTimes.Min Then
txtRetryTimes.Text = updRetryTimes.Min
End If
End Sub
Private Sub txtRetryTimes_GotFocus()
txtRetryTimes.SelStart = 0
txtRetryTimes.SelLength = Len(txtRetryTimes.Text)
End Sub
Private Sub txtRetryTimes_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
Private Sub txtTransDelay_Change()
On Error GoTo FixHandle
updTransDelay.Value = CLng(txtTransDelay.Text)
updDogDelay.Min = updTransDelay.Value
Exit Sub
FixHandle:
If Len(Trim(txtTransDelay.Text)) = 0 Then
txtTransDelay.Text = updTransDelay.Min
ElseIf CLng(txtTransDelay.Text) > updTransDelay.Max Then
txtTransDelay.Text = updTransDelay.Max
ElseIf CLng(txtTransDelay.Text) < updTransDelay.Min Then
txtTransDelay.Text = updTransDelay.Min
End If
End Sub
Private Sub txtTransDelay_GotFocus()
txtTransDelay.SelStart = 0
txtTransDelay.SelLength = Len(txtTransDelay.Text)
End Sub
Private Sub txtTransDelay_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
If KeyAscii = 8 Then Exit Sub
For a = 48 To 57 '此循环将全角数字转为半角数字
If KeyAscii = a - 23680 Then
KeyAscii = a
Exit Sub
End If
Next a
KeyAscii = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -