This is going ot sound strange, my solution seems to be eluding me.
I have the following return codes from a non PB DLL:
See the function ErrToString for the error..
-------------
Scott Turchin
I have the following return codes from a non PB DLL:
See the function ErrToString for the error..
Code:
%INVALID_KEY = -1 %INVALID_PARAM = -2 %MODEM_NOT_RESPONDING = -3 %DIALCMD_DIDNOTECHO = -4 %NOCONNECT_AFTERDIAL = -5 %NETWORK_NOTUP = -6 %NETWORK_DIDNOTRESPOND = -7 %TRANSACTION_GARBLED = -8 %PORT_NOT_INITIALZIED = -9 Each Function is depending on the previous function before it is SUPPOSED to function, so I need to store each return for each function in an array: Function InitDLL() as long Dim MsgArray(1 To 10) As Long Dim MsgStArray(1 To 10) As String Local x As Long Now, I make a function call (1 of 10): Incr x '1) Key = "Reset":Param = "" lResult = FreeCCSDLL(Key,Param) MsgArray(x) = lResult MsgStArray(x) = ErrToString(MsgArray(x)) Incr x So now i have an INTEGER/LONG return code and a corresponding STRING value. Life is good, except the return code is negative, and if the function returns a 1 then it succeeded, 0 if it fails. So I want to add up which one's failed in an array of MsgStArray() but want to keep the numeric in MsgArray(). I thought I had this working once, but it is best to keep the return values in negative connotation, or I can use ABS to convert, but then if the function succeeds it will seem as an error... '------------------------------------------------------------------------------ Function ErrToString(ByVal ErMsg As Long) As String Dim MsgStr(0 To 10) As String Here is the problem, the array can't be dimmed as -1 to -10, or can it? 'DLL Error codes MsgStr(0) = "Function Failed" MsgStr(%INVALID_KEY) = "Invalid Key on Function " '-1 for real, converted to abs is 1, so incr instead MsgStr(%INVALID_PARAM) = "Invalid Parameter" MsgStr(%MODEM_NOT_RESPONDING) = "Modem Not Responding" MsgStr(%DIALCMD_DIDNOTECHO) = "Dial Command did not echo" MsgStr(%NOCONNECT_AFTERDIAL) = "No connection after dialing" MsgStr(%NETWORK_NOTUP) = "Credit Card Network is not up" MsgStr(%NETWORK_DIDNOTRESPOND) = "Credit Card Network did not respond" MsgStr(%TRANSACTION_GARBLED) = "Transaction was garbled" MsgStr(%PORT_NOT_INITIALZIED) = "Com Port did not initialize Function = MsgStr(ErMsg) Erase MsgStr End Function
Scott Turchin
Comment