Option Public
Option Explicit
Const ERR_MASK = &H3fff
Const PKG_MASK = &H3f00
Const ERRNUM_MASK = &H00ff
Declare Function OSLoadString Lib "nnotes.dll" (Byval hModule As Long, Byval stringCode As Integer, _
Byval retBuffer As String, Byval bufferLength As Integer) As Integer
Sub Initialize
Dim fileName As String
Dim fileNum As Integer
Dim i As Integer
Dim errString As String
fileName = "C:\APIErrors.csv"
fileNum = Freefile()
Reset
Open fileName For Output As fileNum
Print #fileNum, "Notes API Errors"
Print #fileNum, "(some of these are informational messages used by Notes and not true errors)"
Print #fileNum, ""
Write #fileNum, "Error Number", "Hex Number", "Error Message"
For i = 0 To &H3FFF
errString = GetAPIError(i)
If (Len(errString) > 0) Then
Write #fileNum, i, Hex$(i), errString
End If
Next
Close fileNum
Print "Finished Exporting Errors"
End Sub
Function GetAPIError (errorCode As Integer) As String
Dim errorString As String*256
Dim returnErrorString As String
Dim resultStringLength As Long
Dim errorCodeTranslated As Integer
errorCodeTranslated = (errorCode And ERR_MASK)
resultStringLength = OSLoadString(0, errorCodeTranslated, errorString, Len(errorString) - 1)
If (Instr(errorString, Chr(0)) > 0) Then
returnErrorString = Left$(errorString, Instr(errorString, Chr(0)) - 1)
Else
returnErrorString = errorString
End If
GetAPIError = returnErrorString
End Function
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.