VBA:Lookup error codes for inRoads, where to

Hi all,

Been playing with inRoads alot lately.

It says in the manual that most functions return only THREE different values, success  = 0, errors = Whatever, or no valid license = -1.
I cannot find anywhere to translate the errors, so I have to guess what they mean:

F.ex.

Loading a DTM that is allready loaded returns "error" = 1211. I GUESS!

Is there somewhere I can look up those codes instead of having to guess?

Regards,
/Torben

(Brrrrr. The climate here is horrible..)

  • Did you try to call scadSDK_getErrorMessage on the error number? From the help file this function is used to interpret the error ids.

    Here is the VBA declaration for it:

    SCadUtility.txt:Public Declare Function scadSDK_getErrorMessage Lib "SCadSDKAT"

    (ByVal errMsg As Long, ByVal errNo As Long) As Long

    HTH,

  • Hi Mark, I did try that, but so far I have failed to use it. There was also something about it not working when running from outside process. But VBA would be "inside" wouldnt it?

    I will try again, thanks!

    *...coding...*


    Here is what I got so far, (and it doesnt fail now :):

    Error code 174: Returns Øì(ûÈwí(®
    All other codes from 1 to 250.000 returns nothing.....

    Judging by the scrambled returned code something is going wrong.
    But judging by the fact that something is returned, I am on the right track :)

    My Code:

    Function inRoadsGetErrorMessageAsString(ERROR_CODE As Long) As String

        ' Try to get some info..
        Dim byts As longString
        
        ' 174:Ìì(ûÈwí(®
        
        If Not INROADS_RUNNING And Not INROADS_SYSTEM_TESTED Then inRoadsInitialize
        
        INROADS_STATUS = SCadDTM.scadSDK_getErrorMessage(byts, ERROR_CODE)
           
        If INROADS_STATUS <> SDK_SUCCESS Then
            inRoadsGetErrorMessageAsString = "UnableToTranslateErrorCode:" & ERROR_CODE
          
        Else
            ' translate byts to a string
            inRoadsGetErrorMessageAsString = byteArrayToString(byts.s)
        End If

    End Function

    And the modified declaration:

    Type longString
       s(256) As Byte
    End Type

    ' Error message TEST:
    Public Declare Function scadSDK_getErrorMessage Lib "SCadSDKAT" (ByRef errMsg As longString, ByVal errNo As Long) As Long

    And the loop.. that only returns something for 174

    Sub testerror()
        
        Dim i As Long, s As String
        
        For i = 0 To 250000
            s = inRoadsGetErrorMessageAsString(i)
            If s <> "" Then Debug.Print i & ":" & s
        Next i
        
        Debug.Print "Done!"
        
    End Sub

    System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.

  • Shameless self bumping..

    I have still not managed to get the error lookup working.

    (The bump resulted in the Post being moved to the RoadDesign forum, from the uStation VBA forum)

    System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.