addma2.frm

来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 117 行

FRM
117
字号
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
Begin VB.Form frmRun 
   Caption         =   "Advantech Demo: Converting & transfering data"
   ClientHeight    =   1830
   ClientLeft      =   2310
   ClientTop       =   2025
   ClientWidth     =   4920
   ControlBox      =   0   'False
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1830
   ScaleWidth      =   4920
   Begin VB.Timer FAIChkTmr 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   360
      Top             =   960
   End
   Begin VB.CommandButton Command1 
      Caption         =   "&Terminal"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1440
      TabIndex        =   0
      Top             =   960
      Width           =   2175
   End
   Begin ComctlLib.ProgressBar ProgressBar1 
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   4455
      _ExtentX        =   7858
      _ExtentY        =   661
      _Version        =   327682
      Appearance      =   1
   End
End
Attribute VB_Name = "frmRun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
  frmDataDisp.Show
  Unload frmRun
End Sub

Private Sub FAIChkTmr_Timer()
Dim iRet As Integer

Dim ptAICheck As PT_FAICheck
Dim lStopped As Long
Dim lRetrieved As Long
Dim lOverrun As Long
Dim lHalfReady As Long
Dim lActiveBuf As Long

  'Get converting status
  ptAICheck.stopped = DRV_GetAddress(lStopped)
  ptAICheck.retrieved = DRV_GetAddress(lRetrieved)
  ptAICheck.Overrun = DRV_GetAddress(lOverrun)
  ptAICheck.HalfReady = DRV_GetAddress(lHalfReady)
  ptAICheck.ActiveBuf = DRV_GetAddress(lActiveBuf)
    
  ErrCde = DRV_FAICheck(DeviceHandle, ptAICheck)
  If (ChkErr(ErrCde)) Then
    FAIChkTmr.Enabled = False
    Exit Sub
  End If

  'Control the status bar
  If (lRetrieved = 0) Then
    lRetrieved = 1
  End If
  ProgressBar1.value = lRetrieved - 1

  'Does convert all data?
  If ((ProgressBar1.value + 1) = ProgressBar1.Max) Then
    If (frmSelDev.chkCyclic.value = 0) Then
      Command1.Caption = "Waiting..."
      frmDataDisp.Show
      Command1.Caption = "&Terminate"
      Unload frmRun
    End If
  End If

End Sub


Private Sub Form_Load()
  FAIChkTmr.Interval = 50
  FAIChkTmr.Enabled = True
  ProgressBar1.Max = Val(frmSelDev.DataCounts)
End Sub


Private Sub Form_Unload(Cancel As Integer)
  frmDataDisp.Show
  Unload frmRun
End Sub


⌨️ 快捷键说明

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