I am trying to interface a gadget with a C++ function in a DLL that needs to send back multiple data values. If I were calling this function from within another C++ program, I would just use reference variables for the function to update, but I don't know how to do anything like that in javascript. I'm sure there's a simple way, but I'm pretty new to javascript, so any help would be great.

Another ActiveX/Com Question
parreg
Derek Ju
public BSTR MyString;
public DWORD LengthofMyString;
public MyClass::MyFunction()
{
\*Some Code to create a string and determine it's length*\
}
and your JavaScript:
var myDLL = new ActiveXObject("myNamespace.MyClass");
myDll.MyFunction();
var y = myDll.MyString;
var x = myDll.LengthofMyString;
BJohansson
var myDLL = new ActiveXObject("<myNamespace>.<myClass>");
myDLL.<myVariable>;
ferrethouse
I guess I wasn't really being clear about what I wanted to do. Let say I had a function that looked like: (ignoring all the neccessary COM stuff that would also be there)
MyClass::MyFunction(BSTR* MyString, DWORD* LengthofMyString)
{
\*Some Code to create a string and determine it's length*\
}
Both parameters are declared as "out" in Visual Studio 2005. At the end of the function I would like MyString to point to some data and LengthofMyString to point to the length. Calling this from C++ I would use
BSTR y;
DWORD x;
MyFunction(&y, &x);
So that x and y would have the values created in the function. I just don't know how to do that in javascript. What I have in my gadget code now looks like:
var myDLL = new ActiveXObject("myNamespace.MyClass");
var y;
var x;
myDll.MyFunction(y,x);
But when I try to output x and y, they say undefined. I know that my gadget can use the DLL because of the other functions I can call, but I don't know how to get these values from my DLL function into the javascript variables. Is there any sort of "address of" operator in javascript Thanks for the help.
HowardRoark
The language that the DLL is written in shouldn't matter as long as it is a legitimate COM DLL. In that situation, you would establish the ActiveX control as an object within the HTML of the page, give it an ID, and call the method with the syntax "ID.methd(param1,param2)".
Here's the oversimplified approach:
Does that answer your question