J
Justin30324
Hello. I have a COM object written in C#. I am creating an instance of
it in JavaScript.
I instantiate the COM object in JavaScript like this:
var myObject = new ActiveXObject("NamespaceName.ClassName");
I have the following function in the C# COM object:
public string CallMe()
{
return "Hello world";
}
I call the function from JavaScript like this:
var strFoo = myObject.CallMe();
strFoo is successfully set to Hello world. (This is good.)
However, what I really want is to pass the variable by reference so I
can return more than one value from the COM object function. This is
the function I cannot get to work:
public void CallMe2(out string strInput1, out string strInput2)
{
strInput1 = "Hello";
strInput2 = "world";
}
I call the fuction from JavaScript like this:
var strResult1 = "xxx";
var strResult2 = "yyy";
myObject.CallMe(strResult1, strResult2);
After the function has returned, strResult1 and strResult2 have not
been changed.
I can call CallMe2 from a C++ program (I pass variants instead of
strings), and the strings are changed to Hello and world. But, the
strings are not changed when I call the function from Java Script. Is
there a way to do this?
Thanks in advance.
Justin
it in JavaScript.
I instantiate the COM object in JavaScript like this:
var myObject = new ActiveXObject("NamespaceName.ClassName");
I have the following function in the C# COM object:
public string CallMe()
{
return "Hello world";
}
I call the function from JavaScript like this:
var strFoo = myObject.CallMe();
strFoo is successfully set to Hello world. (This is good.)
However, what I really want is to pass the variable by reference so I
can return more than one value from the COM object function. This is
the function I cannot get to work:
public void CallMe2(out string strInput1, out string strInput2)
{
strInput1 = "Hello";
strInput2 = "world";
}
I call the fuction from JavaScript like this:
var strResult1 = "xxx";
var strResult2 = "yyy";
myObject.CallMe(strResult1, strResult2);
After the function has returned, strResult1 and strResult2 have not
been changed.
I can call CallMe2 from a C++ program (I pass variants instead of
strings), and the strings are changed to Hello and world. But, the
strings are not changed when I call the function from Java Script. Is
there a way to do this?
Thanks in advance.
Justin