I have a custom ActiveX control that is used by web pages in IE. It loads just fine and is accessible to Javascript running in the page if I load it via an OBJECT tag like this:
<object id="ccl" codeBase="ccl.cab" classid="CLSID:12372D58-F10C-11CF-B7A9-0020AFD6A362" NOEXTERNALDATA="true"></object>
But if I try to load it via new ActiveXObject() like this:
var x = new ActiveXObject('myObj.abc');
I get the error “Automation server can’t create object”.
I thought these two methods of loading a document were equivalent in the case where the ActiveX control has already been installed. But apparently they’re not. Can anyone help me understand under what conditions the OBJECT tag method would succeed while the new ActiveXObject method would fail? I have double-checked to make sure the progID I’m passing into new ActiveXObject() is correct and appears in the registry under HKEY_CLASSES_ROOT\CLSID as it should. Thanks in advance for any ideas.
Thanks to those who submitted the previous answers. While they didn’t provide a solution to my problem, they set me on the right track to find the answer myself.
The problem was that my ActiveX control used the implementation of IObjectSafety provided by Microsoft’s SiteLock template (IObjectSafetySiteLockImpl). As the SiteLock documentation states:
In this case my ActiveX control did not need the SiteLock functionality, so I replaced IObjectSafetySiteLockImpl with the standard ATL implementation of IObjectSafey (IObjectSafetyImpl).