Question

I have an ActiveX (3rd party, no source) with a method that has a reference parameter like this:

HRESULT GetSomething(
[in] short param1,
[out] BSTR* someString);

In C++ you'd execute it like this:

BSTR someString = NULL
m_activeX.GetSomething(0, &someString);

How would I execute this via Javascript? All other functions in the ActiveX work fine, but this one looks impossible? If not possible in Javascript, is it in VBScript? I have had no luck in either.

BTW, This must be done in Internet Explorer

Was it helpful?

Solution

I can't give you a definite answer, but I don't believe it can be done. I hope somebody will prove me wrong, but here's why I think it can't work...

In Javascript, all variables are passed by value. In IE, you'll create an instance of the ActiveXObject javascript class to wrap your COM object. Even if that wrapper object could get the value from your COM object, there's no way in Javascript for it to pass that value back to you.

If you know that you'll be running in IE on Windows, you could try using vbscript instead of javascript. Vbscript does support pass-by-reference so you might have more luck with that.

I hope that helps.

OTHER TIPS

// Using javascript
var someString = activeXObj.GetSomething(0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top