CryptoSys API Library Manual

API_ErrorLookup

Retrieves the error message associated with a given error code.

VBA/VB6 Syntax

Public Declare Function API_ErrorLookup Lib "diCryptoSys.dll" (ByVal strOutput As String, ByVal nMaxChars As Long, ByVal nErrorCode As Long) As Long

nRet = API_ErrorLookup(strOutput, nMaxChars, nErrorCode)

C/C++ Syntax

long __stdcall API_ErrorLookup(char *szOutput, long nMaxChars, long nErrCode);

Parameters

szOutput
[out] to receive error message.
nMaxChars
[in] specifying the maximum number of characters to be received.
nErrCode
[in] specifying the error code for which the message is required.

Returns (VBA/C)

the number of characters in the output string or zero if there is no corresponding error message.

VBA Wrapper Syntax

Public Function apiErrorLookup(nCode As Long) As String

.NET Equivalent

General.ErrorLookup Method
General.FormatErrorMessage Method

C++ (STL) Equivalent

static std::string crsysapi::Err::ErrorLookup (int errCode)
static std::string crsysapi::Err::FormatErrorMessage (int errCode=0)

Python Equivalent

static Gen.error_lookup(n)

Remarks

The error message will never be longer than 127 characters.

Example

Dim nErrCode As Long
nErrCode = 33
Debug.Print "ErrorLookup(" & nErrCode & ")=" & apiErrorLookup(nErrCode)
ErrorLookup(33)=Invalid key length (BAD_KEY_LEN_ERROR)

To display all possible error messages:

    Dim nRet As Long
    Dim strErrMsg As String * 128
    Dim i As Integer
    
    For i = 0 To 10000
        nRet = API_ErrorLookup(strErrMsg, Len(strErrMsg), i)
        If (nRet > 0) Then
            Debug.Print i & " = " & Left(strErrMsg, nRet)
        End If
    Next

See Also

Error codes

[Contents] [Index]

[PREV: API_ErrorCode...]   [Contents]   [Index]   
   [NEXT: API_LicenceType...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.