Tyco Electronics 1525l Car Video System User Manual


 
MagTek Device Drivers for Windows
82
instruct the device to return the card data when swiped. All the facilities of the driver are utilized
during this stage of operation.
Close the device
When the application is finished with the device, it simply closes the port using the handle
obtained when it opened it. The driver shuts down the device if required.
Note
In some cases with Windows 95, the Driver may not be closed
properly. This will leave the port open and will prevent further
communications with that device until the computer is rebooted.
METHODS OF ACCESSING THE DEVICE
This section describes how to use control language commands in a Visual Basic development
environment using the MSComm (Microsoft Communication) component.
Obtaining access to the device
If the MSComm (Microsoft Communication) ActiveX component is used to access the device,
set the
CommPort property to the com port number of the device. Then, set the PortOpen
property to True to open it. The following example shows how:
‘set error handling
On Error Resume Next
‘open the port
Comm.CommPort = 5
Comm.PortOpen = True
If Err.Number <> 0 Then
<<process error>>
End If
on error goto 0
Note
After issuing an Open command, the computer may spend several
seconds attempting to communicate with the device. During this
time the computer will appear to be hung up.
If file I/O access is desired, you have the option of using either the device’s friendly name, such
as
\\.\micr+ (where \\.\ specifies to Windows that this is a device and not a file) or its port
name, COM<5..15>. The friendly name is more intuitive and easier to remember than a port
number; however, the serial method gives the programmer better control of the device. The port
number can be found in the operating system’s device UI. For example, open Control
Panel/System/Device Manager/MagTek and select a specific driver. Under Properties, select the