careta
March 19th, 2003, 05:05 AM
I have a .NET class that I register (with regasm) as a
COM object. It has a method that returns to caller an array of ints. I
create that object from Vbscript and try to get the returned array,
but get a runtime error.
The .NET class (simplified):
public class myclass {
public myclass{
...
}
public int link(string ip){
// no problem calling this method
...
return 1;
}
public int getcounter(int param1, out ulong[] myarray){
// can't call this method
myarray = new ulong[2];
myarray[0] = 0;
myarray[1] = 1;
return 1;
}
}
The class is registred with regasm and called from vbscript as follows
'this is test.vbs
dim arr
set myobj = CreateObject("myclass.myclass")
ret = myobj.link("192.168.100.101")
ret = myobj.getcounter(1, arr)
Creation of the object and the call to "link" method works fine. The
call to getcounter throws at vbscript exception 800A0005 "Invalid
procedure call or argument: 'getcounter'"
I guess this has to do with the "out" parameter, but I don't know how
to make this work.
Thanks,
careta
COM object. It has a method that returns to caller an array of ints. I
create that object from Vbscript and try to get the returned array,
but get a runtime error.
The .NET class (simplified):
public class myclass {
public myclass{
...
}
public int link(string ip){
// no problem calling this method
...
return 1;
}
public int getcounter(int param1, out ulong[] myarray){
// can't call this method
myarray = new ulong[2];
myarray[0] = 0;
myarray[1] = 1;
return 1;
}
}
The class is registred with regasm and called from vbscript as follows
'this is test.vbs
dim arr
set myobj = CreateObject("myclass.myclass")
ret = myobj.link("192.168.100.101")
ret = myobj.getcounter(1, arr)
Creation of the object and the call to "link" method works fine. The
call to getcounter throws at vbscript exception 800A0005 "Invalid
procedure call or argument: 'getcounter'"
I guess this has to do with the "out" parameter, but I don't know how
to make this work.
Thanks,
careta