beautypg.com

Elo TouchSystems 1525L User Manual

Page 131

background image

MagTek Device Drivers for Windows


128

' will hold the numeric port number
Dim PortNumber As Integer

' prevent the Start button from being pressed again
btnStart.Enabled = False

txtInfo.Text = "Please wait.

Opening the port as File IO"

txtInfo.Refresh

' declare space for an input buffer
buf$ = String(2000, Chr$(0))

' If the virtual serial port number is unknown, it can be
' obtained by opening the driver in "File" mode with
' the "Friendly Name" and asking for the virtual COM port number.
'
' The sequence is:
' 1) Open the driver as a binary file
' 2) Request the "port_name" property
' 3) Close the driver
' 4) Open the serial port using the number obtained above
' 5) Send/receive commands/data
' 6) Close the serial port when done
'
' As of release 1.08.01 of the MTD drivers,
' the default Friendly Names are:
' -------------------------------------------------------------------
' "Mag-Wedge"
' "MT-85"
' "MT-95"
' "Port-powered swipe reader"
' "Port-powered insert reader"
' "MiniWedge"
' "MICR+"
' "Mini MICR RS-232"
' "Mini MICR Wedge"
' "IntelliPIN RS-232"
' "IntelliPIN Wedge"
' "IntelliPIN MICR Aux"
' "Generic Serial (RS-232)"
' "Generic Wedge (Keyboard)"
'
' Prepend "\\.\" to the "friendly" name which
' tells Windows that this is a device name and not a file name
NewName$ = "\\.\" + "MiniWedge"

' Trap the "file not found" error if the
' device is not present or ready
On Error Resume Next

' Try to open the device, this can take anywhere from one
' second to one minute
Open NewName For Binary Access Read Write As #1

' If the driver was unable to open the device, then
' inform the user