home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / devtools / files / lb202win.exe / LB202W.EXE / ERHANDLR.BAS < prev    next >
Encoding:
BASIC Source File  |  1999-06-17  |  567 b   |  28 lines

  1.  
  2.     'open com2
  3.     open "COM2:9600,n,8,1" for random as #1
  4.  
  5.     'enable the com error handler
  6.     oncomerror [handleIt]
  7.  
  8.     'try to open com2 again, triggering handler
  9.     open "COM2:9600,n,8,1" for random as #2
  10.  
  11.     'we never get this far because of the error
  12.     print "we never get this far because of the error"
  13.     input r$
  14.  
  15. [handleIt]
  16.  
  17.     'disable the com error handler
  18.     oncomerror
  19.  
  20.     'print out the error and port
  21.     print "Error: "; ComError$
  22.     print "Port number: "; ComPortNumber
  23.  
  24.     'close com2
  25.     close #1
  26.  
  27.     end
  28.