Calling API Message Functions

The C language LayGO API message functions, such as lgo_ErrorMessage() return pointers to NUL-terminated arrays of one byte characters. These are not directly useful in Visual Basic, so the LayGO API provides an alternative set of functions, such as lgo_GetErrorMessage(), which copy the character strings into Visual Basic Strings. This allows Visual Basic applications to use the following conversion code:

Dim message As String * 128
Dim n As Integer

n = lgo_GetErrorMessage(result, message, 128)

message = Left(message, n - 1)

Because they are used so frequently, Laygo32.bas exports a set of wrapper functions which return the messages as Visual Basic Strings:

This allows you to write:
LogError "Failure opening protocol service: " & _
              lgo_ErrorMessage(result)

Laygo32.bas also exports a set of wrapper functions for the X.25 diagnostic messages: