Hi. I am trying to pass a COM object from an ActiveX component to JScript. So far I have tried the following method of doing so:
STDMETHODIMP CHSNetwork::CreateIPPPacket(VARIANT ** ppv)
{
IIPPacket *iipp;
HRESULT hr = CoCreateInstance(CLSID_IPPacket, NULL, CLSCTX_ALL, IID_IIPPacket, (void **)&iipp);
if(SUCCEEDED(hr) && ppv)
{
CComVariant cvar((IUnknown *)iipp);
hr = cvar.Detach(*ppv);
}
return hr;
}
The following JScript causes the error Variable uses an Automation type not supported in JScript
:
var hsn = new ActiveXObject("ZIENetwork.HSNetwork");
var ipp = hsn.CreateIPPPacket();
Any help would be greatly appreciated. Thanks.