Private Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
Sub Main()
Dim i As Long
Open App.Path & "\SystemErrorDescr.txt" For Output As #1
For i = 1 To 15999
Print #1, i & ": " & GetErrorMsg(i)
Next
Close #1
End Sub
Public Function GetErrorMsg(Optional ErNumb As Long = 0) As String
' the bigest number is 15999
' Info: http://msdn.microsoft.com/en-us/library/ms681381%28v=VS.85%29.aspx
Dim tmp As String
Dim aaa As String
tmp = Space(200)
FormatMessage &H1000, ByVal 0&, ErNumb, &H0, tmp, Len(tmp), ByVal 0&
aaa = Trim(tmp)
If (aaa = vbNullString) Then aaa = "UnKown Description."
aaa = Replace(aaa, Chr(13), vbNullString)
GetErrorMsg = aaa
End Function
se que las descripciones faltantes hay que extraerlas desde archivos especificos del sistema.
De Mas esta decir que el Error "0" (Cero) No Existe.
0 es el numero designado a ERROR_SUCCESS
ERROR_SUCCESS 0 (0x0) | The operation completed successfully. |