home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 August / Chip_1999-08_cd.bin / sharewar / wscmclib / ERRORS32.BAS < prev    next >
BASIC Source File  |  1999-05-31  |  1KB  |  48 lines

  1. Attribute VB_Name = "ERRORS32"
  2. '
  3. ' ERRORS32.BAS
  4. '
  5.  
  6. Option Explicit
  7.  
  8. DefInt A-Z
  9.  
  10. Dim Text As String * 120
  11.  
  12. Function GetErrorText(ByVal ErrorCode As Long) As String
  13. Dim Win32Err As Long
  14. Select Case ErrorCode
  15.   Case IE_BADID
  16.      GetErrorText = "Invalid COM port name"
  17.   Case IE_OPEN
  18.      GetErrorText = "COM port already open"
  19.   Case IE_NOPEN
  20.      GetErrorText = "Cannot open COM port"
  21.   Case IE_MEMORY
  22.      GetErrorText = "Unable to allocate memory"
  23.   Case IE_DEFAULT
  24.     GetErrorText = "Error in default parameters"
  25.   Case IE_HARDWARE
  26.      GetErrorText = "Hardware not present"
  27.   Case IE_BYTESIZE
  28.      GetErrorText = "Unsupported byte size"
  29.   Case IE_BAUDRATE
  30.      GetErrorText = "Unsupported baud rate"
  31.   Case WSC_NO_DATA
  32.      GetErrorText = "No data"
  33.   Case WSC_RANGE
  34.      GetErrorText = "Parameter out of range"
  35.   Case WSC_ABORTED
  36.      GetErrorText = "Shareware version corrupted"
  37.   Case WSC_WIN32ERR:
  38.      Win32Err = SioWinError(Text, 120)
  39.      GetErrorText = Text
  40.   Case Else
  41.      GetErrorText = "Error code " + Str$(ErrorCode)
  42.   End Select
  43. End Function
  44.  
  45. Sub SayError(F As Form, ByVal ErrorCode)
  46. F.Print GetErrorText(ErrorCode)
  47. End Sub
  48.