Signametrics
32
Global.bas module file contents:
Option Explicit
'function declarations
Declare Function SCANInit Lib "smX4032.dll" _
(ByVal nScanner As Long) As Long
Declare Function SCANSetConfig Lib "SMX4032.DLL" _
(ByVal nScanner As Long, ByVal Config As Long) As Long
Declare Function SCANErrString Lib "SMX4032.DLL" _
(ByVal nError As Long, ByVal errString As String, ByVal stringlen As Long) As Long
Declare Function SCANSelectChannel Lib "SMX4032.DLL" _
(ByVal nScanner As Long, ByVal nChannel As Long) As Long
'Configuration definitions for :
Global Const TwoWire = 0
Global Const FourWire = 7
Global Const SixWire = &H1E
' Since the DLL is written in "C", where TRUE = 1 and FALSE = 0
' and VB has -1 for True, use YES and NO instead of True and False
Global Const YES = 1
Global Const NO = 0
‘Error handling code:
Public Sub ShowFault(status As Long)
Dim errtext As String * 48
Dim errcode As Long
Dim start As Single
If status < 0 Then
errcode = SCANErrString(status, errtext, 48)
SimplePanel.TextLine.Text = errtext
If status <> -3 Then 'if not autorange wait with message
start = Timer
While ((Timer - start) < 2#) 'delay for 1.1 seconds
DoEvents
Wend
End If
SimplePanel.TextLine.Text = ""
End If
End Sub
SimplePanel.frm Form file contents:
Option Explicit
Private Sub CommandSelect_Click()
ShowFault SCANSelectChannel(0, Lng(TextChan.Text)) 'Select the channel
End Sub
Private Sub Form_Load()
Dim errtext As String * 64
Dim i, j, k As Long
i = SCANInit(0) 'Initialize scanner 0
End Sub
Private Sub Option2W_Click()
ShowFault SCANSetConfig(0, TwoWire)
End Sub
Private Sub Option4W_Click()
ShowFault SCANSetConfig(0, FourWire)