My C#
code:
bvt = Activator.CreateInstance(Type.GetTypeFromProgID("xxx.BVT"));
// calling a function that terminates with an error
bvt.GiveMeAnError();
var msg = "";
long number = 0L;
bvt.GetLastError(number, msg);
result = "Errornumber:"+ number + " Errormessage:"+ msg;
The result is:
"Errornumber:0 Errormessage:"
My problem is the function GetLastError()
. Number
and msg
should contain the errornumber
and message
after execution of this function. But they are still empty
.
Can somebody help me?
* EDIT *
I executed the following code as VBScript:
Dim StdOut
Set StdOut = WScript.StdOut
Set bvt = CreateObject( "xxx.BVT" )
bvt.GiveMeAnError()
bIsLastErr = bvt.GetLastError( ErrNo, ErrMsg )
StdOut.WriteLine( "Erronumber: " & ErrNo & ", Errormessage: " & ErrMsg )
This VBScript with cscript is working fine. I also get the errormessage and number. So the GetLastError() Method works.
You need to pass the variables by reference as they're apparently set in the method:
bvt.GetLastError(ref number, ref msg);