setting.frm
来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 361 行
FRM
361 行
VERSION 5.00
Begin VB.Form frmSetting
BorderStyle = 3 'Fixed Dialog
Caption = "Setting"
ClientHeight = 3825
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6480
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 6480
ShowInTaskbar = 0 'False
Begin VB.Frame Frame3
Caption = "Scan Channel"
Height = 855
Left = 4560
TabIndex = 23
Top = 120
Width = 1605
Begin VB.ComboBox cmbScanChl
Height = 315
Left = 240
Style = 2 'Dropdown List
TabIndex = 24
Top = 360
Width = 1230
End
End
Begin VB.Frame Frame2
Caption = "Select Device"
Height = 855
Left = 120
TabIndex = 21
Top = 120
Width = 4335
Begin VB.CommandButton cmdSelDevice
Caption = "Select Device from Device List"
Height = 495
Left = 120
TabIndex = 22
Top = 240
Width = 4095
End
End
Begin VB.Frame Frame1
Caption = "Gain Option"
Height = 855
Index = 3
Left = 240
TabIndex = 12
Top = 1080
Width = 1215
Begin VB.OptionButton optGainopt
Caption = "Overall"
Height = 255
Index = 0
Left = 120
TabIndex = 20
Top = 240
Value = -1 'True
Width = 975
End
Begin VB.OptionButton optGainopt
Caption = "Gain List"
Enabled = 0 'False
Height = 255
Index = 1
Left = 120
TabIndex = 19
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "Input Range"
Height = 855
Index = 4
Left = 1560
TabIndex = 10
Top = 1080
Width = 1455
Begin VB.ComboBox cmbInputRange
Height = 315
Left = 120
Style = 2 'Dropdown List
TabIndex = 11
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "Pacer Rate"
Height = 855
Index = 5
Left = 3120
TabIndex = 7
Top = 1080
Width = 1455
Begin VB.TextBox txtPacerRate
Height = 315
Left = 120
TabIndex = 8
Text = "Edit"
Top = 360
Width = 855
End
Begin VB.Label Label2
Caption = "Hz"
Height = 300
Left = 1080
TabIndex = 9
Top = 480
Width = 255
End
End
Begin VB.Frame Frame1
Caption = "Conv. #"
Height = 855
Index = 6
Left = 4680
TabIndex = 5
Top = 1080
Width = 1455
Begin VB.TextBox txtConv
Height = 315
Left = 120
TabIndex = 6
Text = "Edit"
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "Single/Auto"
Height = 1095
Index = 7
Left = 240
TabIndex = 4
Top = 2040
Width = 1215
Begin VB.OptionButton optCyclicsel
Caption = "NonCyclic"
Height = 375
Index = 0
Left = 120
TabIndex = 18
Top = 240
Width = 1050
End
Begin VB.OptionButton optCyclicsel
Caption = "Cyclic"
Height = 375
Index = 1
Left = 120
TabIndex = 17
Top = 600
Width = 1050
End
End
Begin VB.Frame Frame1
Caption = "Triggering"
Height = 1095
Index = 8
Left = 1560
TabIndex = 3
Top = 2040
Width = 1455
Begin VB.OptionButton optTrigger
Caption = "Internal"
Height = 375
Index = 0
Left = 120
TabIndex = 16
Top = 240
Width = 975
End
Begin VB.OptionButton optTrigger
Caption = "External"
Height = 375
Index = 1
Left = 120
TabIndex = 15
Top = 600
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "Data Type"
Height = 1095
Index = 10
Left = 3120
TabIndex = 2
Top = 2040
Width = 1455
Begin VB.OptionButton optDatatype
Caption = "Raw Data"
Height = 375
Index = 0
Left = 120
TabIndex = 14
Top = 240
Width = 1050
End
Begin VB.OptionButton optDatatype
Caption = " Voltage"
Height = 375
Index = 1
Left = 120
TabIndex = 13
Top = 600
Width = 975
End
End
Begin VB.CommandButton CancelButton
Cancel = -1 'True
Caption = "Cancel"
Height = 375
Left = 4013
TabIndex = 1
Top = 3360
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "OK"
Default = -1 'True
Height = 375
Left = 1440
TabIndex = 0
Top = 3360
Width = 1215
End
End
Attribute VB_Name = "frmSetting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub cmbInputRange_Click()
gDevPar.lGainCode = cmbInputRange.ListIndex
End Sub
Private Sub cmbScanChl_Click()
gDevPar.lScanChannel = cmbScanChl.ListIndex
End Sub
Private Sub cmdSelDevice_Click()
Dim i As Integer, j As Integer
Dim szBuffer As String * 40, szTmp As String
Dim ptFeatures As PT_DeviceGetFeatures
Dim DevFeature As DEVFEATURES
Dim ptAIGetConfig As PT_AIGetConfig
Dim ConfigAI As DEVCONFIG_AI
ErrCde = DRV_SelectDevice(Me.hWnd, False, gDevPar.lDeviceNum, szBuffer)
If (ChkErr(ErrCde) <> 0) Then
Exit Sub
End If
cmdSelDevice.Caption = szBuffer
'open device
ErrCde = DRV_DeviceOpen(gDevPar.lDeviceNum, DeviceHandle)
If (ChkErr(ErrCde) <> 0) Then
Exit Sub
End If
'get device features
ptFeatures.buffer = DRV_GetAddress(DevFeature)
ErrCde = DRV_DeviceGetFeatures(DeviceHandle, ptFeatures)
If (ChkErr(ErrCde) <> 0) Then
DRV_DeviceClose DeviceHandle
Exit Sub
End If
'Initialize Range Combobox with device features
If DevFeature.usNumGain <> 0 Then
cmbInputRange.Enabled = True
cmbInputRange.Clear
For i = 0 To DevFeature.usNumGain
szTmp = ""
For j = 0 To 15
szTmp = szTmp + Chr(DevFeature.glGainList(i).szGainStr(j))
Next j
cmbInputRange.AddItem szTmp
Next i
cmbInputRange.ListIndex = 0
Else
cmbInputRange.Enabled = False
cmbInputRange.Clear
End If
'get device AI config
ptAIGetConfig.buffer = DRV_GetAddress(ConfigAI)
ErrCde = DRV_AIGetConfig(DeviceHandle, ptAIGetConfig)
If (ChkErr(ErrCde) <> 0) Then
DRV_DeviceClose DeviceHandle
Exit Sub
End If
'initialize scan channel
If (ConfigAI.ulChanConfig = 0) Then 'single input
j = DevFeature.usMaxAISiglChl
Else 'diff input
j = DevFeature.usMaxAIDiffChl
End If
For i = 0 To j
cmbScanChl.AddItem i
Next i
cmbScanChl.ListIndex = gDevPar.lScanChannel
'close device
DRV_DeviceClose DeviceHandle
End Sub
Private Sub Form_Load()
cmdSelDevice_Click
optCyclicsel(gDevPar.iCyclicMode).value = True
optDatatype(gDevPar.iDataType).value = True
optTrigger(gDevPar.iTrigger).value = True
txtPacerRate.Text = gDevPar.lPacerRate
txtConv.Text = gDevPar.lConvNum
End Sub
Private Sub OKButton_Click()
'get conversion number, pacer rate
If (Not IsNumeric(txtConv.Text)) Then
MsgBox "Please Input Numeric Conv.#!", vbOKOnly Or vbInformation, "Error"
Exit Sub
End If
If (Not IsNumeric(txtPacerRate.Text)) Then
MsgBox "Please Input Numeric Pacer Rate!", vbOKOnly Or vbInformation, "Error"
Exit Sub
End If
gDevPar.lConvNum = Val(txtConv.Text)
gDevPar.lPacerRate = Val(txtPacerRate.Text)
Unload Me
End Sub
Private Sub optCyclicsel_Click(Index As Integer)
gDevPar.iCyclicMode = Index
End Sub
Private Sub optDatatype_Click(Index As Integer)
gDevPar.iDataType = Index
End Sub
Private Sub optTrigger_Click(Index As Integer)
gDevPar.iTrigger = Index
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?