This is a lil program to return the string value of an Err.
Life is good, saw a shareware program that does this, thot I'd pull the dust off of this function.
but how can you find the error description for an EventID from the NT Event log?
------------------
Scott
Life is good, saw a shareware program that does this, thot I'd pull the dust off of this function.
but how can you find the error description for an EventID from the NT Event log?
Code:
%NOANIMATE = 1 %NODRAGLIST = 1 %NOHEADER = 1 %NOIMAGELIST = 1 %NOLISTVIEW = 1 %NOTABCONTROL = 1 %NOTRACKBAR = 1 %NOTREEVIEW = 1 %NOUPDOWN = 1 '------------------------------------------------------------------------------------------------------------ #Compile Exe #Option Version5 #Register None #Include "Win32api.inc" '------------------------------------------------------------------------------------------------------------ Declare Function GetLastErrorDescription( ByVal ErrorCode As Long, ByVal UseLastError As Long ) As String '------------------------------------------------------------------------------------------------------------ Function WinMain (ByVal hInstance As Long, _ ByVal hPrevInstance As Long, _ lpCmdLine As Asciiz Ptr, _ ByVal iCmdShow As Long) As Long Local ErMsg As Long ErMsg = Val(Trim$(Command$)) MsgBox GetLastErrorDescription(ByVal ErMsg,0) End Function '------------------------------------------------------------------------------------------------------------ Function GetLastErrorDescription( ByVal ErrorCode As Long, ByVal UseLastError As Long ) Export As String Dim sRtrnCode As Asciiz * 256 Dim lRet As Long If UseLastError Then ErrorCode = GetLastError() If ErrorCode = %ERROR_SUCCESS Then Exit Function lRet = FormatMessage( %FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, ErrorCode, 0&, sRtrnCode, SizeOf( sRtrnCode ), 0& ) If lRet > 0 Then Function = Left$( sRtrnCode, lRet ) End Function '------------------------------------------------------------------------------------------------------------
Scott
Comment