Introduction
I've reorganized the win32 error code to Visual Basic enum
values, and shared this code with you in this small tip.
Using the Code
Public Declare Function GetLastError Lib "kernel32" Alias "GetLastError" () As Integer
The returns Integer value from the GetLastError
can be converted to the ErrorCodes
. These ErrorCodes
can be found from MSDN pages here and here:
Public Enum ErrorCodes As Integer
End Enum
All of the error codes enum
values can be found in the zip attachment at the top of this tip. Here is the wrapper function:
Public Function GetLastErrorCode() As ErrorCodes
Return CType(GetLastError, ErrorCodes)
End Function