c++ - Looks like COM object is created, but JScript fails to get a reference -
i'm using following code create com component have developed , registered.
var mycom = new activexobject("mirabilis.componentservices.1"); mycom.setfirstnumber(5); mycom.setsecondnumber(3);
the first line runs fine, while if alter progid (that is, string passed activexobject) message automation server can't create object. suggests @ least basics of registration mechanism working properly.
i integrated logging calls dll. when run script proof log file both call queryinterface:
stdapi dllgetclassobject( const clsid &clsid, const iid &iid, void **ppv) { ... caddfactory *paddfact = new caddfactory; ... hresult hr = paddfact->queryinterface(iid, ppv); if (hr == s_ok) writetologfile("class queryinterface returned s_ok"); else writetologfile("class queryinterface failed"); return hr; ... }
and one:
hresult __stdcall caddfactory::createinstance( iunknown *punknownouter, const iid &iid, void **ppv) { ... caddobj *pobject = new caddobj; ... hresult hr = pobject->queryinterface(iid, ppv); if (hr == s_ok) writetologfile("object queryinterface returned s_ok"); else writetologfile("object queryinterface failed"); return hr; ... }
return s_ok. however, when jscript gets line 3 of script, following error message:
'mycom' null or not object
why happening? looks jscript should able obtain reference.
some attempts made
- i tried return s_false dllcanunloadnow sure dll not unloaded, in case, no luck.
update
i should review com/ole/activex theory... adding logging calls found out jscript able reference com object, , makes total of 6 queryinterface calls it, , all fail. among these there attempt retrieve idispatch, mandatory objects used scripting languages. think implementing idispatch need make work?
Comments
Post a Comment