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

📄 gain.frm

📁 16 relay output channels and 16 isolated digital input channels LED indicators to show activated
💻 FRM
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmGainCdeSet 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Gain code setting for individual channel"
   ClientHeight    =   5130
   ClientLeft      =   3270
   ClientTop       =   2595
   ClientWidth     =   4185
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   5130
   ScaleWidth      =   4185
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   375
      Left            =   2880
      TabIndex        =   3
      Top             =   360
      Width           =   1095
   End
   Begin ComctlLib.ListView lvGain 
      Height          =   3975
      Left            =   240
      TabIndex        =   2
      Top             =   960
      Width           =   3735
      _ExtentX        =   6588
      _ExtentY        =   7011
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      _Version        =   327682
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   3
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Physical Chan"
         Object.Width           =   1411
      EndProperty
      BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Alignment       =   2
         SubItemIndex    =   1
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Gain"
         Object.Width           =   1411
      EndProperty
      BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Alignment       =   2
         SubItemIndex    =   2
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Configuration"
         Object.Width           =   1764
      EndProperty
   End
   Begin VB.ComboBox cmbGain 
      Height          =   315
      Left            =   240
      TabIndex        =   0
      Text            =   "cmbGain"
      Top             =   480
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "Gain"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   120
      Width           =   495
   End
End
Attribute VB_Name = "frmGainCdeSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit




Private Sub cmbGain_Click()
Dim i As Integer
Dim tempStr As String

    'Store individual gain code setting
    iGainIndex((lvGain.SelectedItem.Index - 1 _
    + PhyChanToLogChan(lpDEVCONFIG_AI, frmSelDev.CombStartCh)) Mod gwMaxLogChanNum) _
            = cmbGain.ListIndex
    
    tempStr = ""
    For i = 0 To 15
        tempStr = tempStr + Chr(lpDevFeatures.glGainList(cmbGain.ListIndex).szGainStr(i))
    Next i
    lvGain.ListItems.Item(lvGain.SelectedItem.Index).SubItems(1) = tempStr
End Sub

Private Sub cmdExit_Click()
    Unload frmGainCdeSet
    frmSelDev.Show
End Sub

Private Sub Form_Load()
Dim i As Integer, j As Integer
Dim ptDevFeature As PT_DeviceGetFeatures
Dim tempStr As String
Dim rStyle As Long
Dim R As Long
Dim lstItem As ListItem
Dim iPhyChan As Integer   'Physical channel number


     'Open selected device for getting more informations
     ErrCde = DRV_DeviceOpen(dwDeviceNum, DeviceHandle)
     If (ChkErr(ErrCde)) Then
        Exit Sub
     End If
     
     'Device's informations is stored as Features and configurations
     ptDevGetFeatures.buffer = DRV_GetAddress(lpDevFeatures)
     ErrCde = DRV_DeviceGetFeatures(DeviceHandle, ptDevGetFeatures)
     If (ChkErr(ErrCde)) Then
         DRV_DeviceClose (DeviceHandle)
         Exit Sub
     End If
     
     ptAIGetConfig.buffer = DRV_GetAddress(lpDEVCONFIG_AI)
     ErrCde = DRV_AIGetConfig(DeviceHandle, ptAIGetConfig)
     If (ChkErr(ErrCde)) Then
         DRV_DeviceClose (DeviceHandle)
         Exit Sub
     End If
     
     gwMaxLogChanNum = GetMaxLogChanNum(lpDEVCONFIG_AI, lpDevFeatures)
     'Close device
     DRV_DeviceClose (DeviceHandle)

    'Clear gain code combo box
    cmbGain.Clear
    
    'Set gain selection
    For i = 0 To (lpDevFeatures.usNumGain - 1)
        tempStr = ""
        For j = 0 To 15
            tempStr = tempStr + Chr(lpDevFeatures.glGainList(i).szGainStr(j))
        Next j
        cmbGain.AddItem tempStr
    Next i
    cmbGain.Text = cmbGain.List(0)
    
   'get the current ListView style
    rStyle = SendMessageLong(lvGain.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
    rStyle = rStyle Or LVS_EX_GRIDLINES Or LVS_EX_FULLROWSELECT
   'set the new ListView style
    R = SendMessageLong(lvGain.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
    
    'Only show valid channels for selection
    iPhyChan = Val(frmSelDev.CombStartCh.Text)
    For i = 0 To (Val(frmSelDev.CombChCount.Text) - 1)
        If (lpDEVCONFIG_AI.ulChanConfig = 1) Then
            If iPhyChan >= lpDevFeatures.usMaxAIDiffChl Then
                iPhyChan = iPhyChan - lpDevFeatures.usMaxAIDiffChl
            End If
        ElseIf iPhyChan >= lpDevFeatures.usMaxAISiglChl Then
            iPhyChan = iPhyChan - lpDevFeatures.usMaxAISiglChl
        End If
                
        Set lstItem = lvGain.ListItems.Add(i + 1, , "Chan " & Str(iPhyChan))
        tempStr = ""
        For j = 0 To 15
            tempStr = tempStr + Chr(lpDevFeatures.glGainList(iGainIndex(PhyChanToLogChan(lpDEVCONFIG_AI, iPhyChan))).szGainStr(j))
        Next j
        lstItem.SubItems(1) = tempStr
        
        If (lpDEVCONFIG_AI.ulChanConfig = 1) Then
            lstItem.SubItems(2) = "Differential"
            lstItem.Text = "Chan " & Str(iPhyChan)
        ElseIf iPhyChan < 32 Then
            If (lpDEVCONFIG_AI.ulChanConfig And SHL(1, iPhyChan)) Then
                lstItem.SubItems(2) = "Differential"
                If (iPhyChan Mod 2) = 0 Then
                    iPhyChan = iPhyChan + 1
                End If
                lstItem.Text = "Chan " & Str(iPhyChan - 1) & "," & Str(iPhyChan)
            Else
                lstItem.SubItems(2) = "Single-Ended"
            End If
        Else
            If (lpDEVCONFIG_AI.ulChanConfigEx(0) And SHL(1, iPhyChan - 32)) Then
                lstItem.SubItems(2) = "Differential"
                If (iPhyChan Mod 2) = 0 Then
                    iPhyChan = iPhyChan + 1
                End If
                lstItem.Text = "Chan " & Str(iPhyChan - 1) & "," & Str(iPhyChan)
            Else
                lstItem.SubItems(2) = "Single-Ended"
            End If
        End If
        
    iPhyChan = iPhyChan + 1

    Next i
    
    
End Sub

Private Sub lvGain_Click()
    cmbGain.Text = cmbGain.List(iGainIndex((lvGain.SelectedItem.Index - 1 _
        + PhyChanToLogChan(lpDEVCONFIG_AI, frmSelDev.CombStartCh)) Mod gwMaxLogChanNum))
End Sub

⌨️ 快捷键说明

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