In QB there was a way to retrieve the error description
71 = Disk not ready
etc..
Was this some call to dos?
------------------
71 = Disk not ready
etc..
Was this some call to dos?
------------------
DECLARE FUNCTION SystemErrorMessageText (BYVAL ECode AS LONG) AS STRING FUNCTION SystemErrorMessageText (BYVAL ECode AS LONG) AS STRING LOCAL Buffer AS ASCIIZ * 255 FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, ECode, %NULL, buffer, SIZEOF(buffer), BYVAL %NULL FUNCTION = FORMAT$(ECode, "##### ") & Buffer END FUNCTION X = SomeApiCallWhichReturnsFalseOnError IF ISFALSE (x) THEN E = GetLastError MSGBOX SystemErrorMessageText (E) END IF
Function GetErrorDescription( ByVal nError As Long ) As String Dim sRtrnCode As String Dim lRet As Long sRtrnCode = String$( 2000, Chr$( 0 ) ) lRet = FormatMessage( %FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, nError, 0&, ByVal StrPtr( sRtrnCode ), Len( sRtrnCode ), ByVal 0& ) If lRet > 0 Then Function = Left$( sRtrnCode, lRet ) End Function
Function AppError(ErrType As Long) Export As String Dim Er(100) As String Er(0)= "No Error Er(5)= "Illegal Function Call Er(7)= "Out of memory Er(9)= "Subscript / Pointer Out of range Er(51)= "Internal Error Er(52)= "Bad file Name Or number Er(53)= "File Not found Er(54)= "Bad file mode Er(55)= "File is already Open Er(57)= "Device I/O Error Er(58)= "File already exists Er(61)= "Disk full Er(62)= "Input past End Er(63)= "Bad record number Er(64)= "Bad file Name Er(67)= "Too many files Er(68)= "Device unavailable Er(70)= "Permission denied Er(71)= "Disk Not ready Er(72)= "Disk media Error Er(74)= "Rename across disks Er(75)= "Path/File access Error Er(76)= "Path/File Not found" Er(76)= "Error " + Trim$(Str$(ErrType)) If Er(Errtype) <> "" Then Function = Er(ErrType) Else Function = "Unknown Error (" + Ltrim$(Str$(ErrType)) + ")" End If Erase Er End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment