Auto-Register ActiveX object client side
-
I have an activex object, testObject.dll, under my website. I instantiate the activex object under javascript like so: "var obj = new ActiveXObject("testObjectNameSpace.testObjectClass");". But the only way this will work is if I register the .dll on the local machine otherwise I get this error: "automation server can't create object". I tried putting in the tag with classid and everything, but then I get a "object not defined" error when I run the javascript (i.e, if the object has id "objectTest" and one of the methods in the activex object is displayRandomText, I get the error on the javascript: "objectTest.displayRandomText();"). How can I make it so the client can automatically register the activex object without having to do it manually using the regasm command (i.e. regasm testObject.dll /tlb:testObjectNet.dll /codebase)?
-
I have an activex object, testObject.dll, under my website. I instantiate the activex object under javascript like so: "var obj = new ActiveXObject("testObjectNameSpace.testObjectClass");". But the only way this will work is if I register the .dll on the local machine otherwise I get this error: "automation server can't create object". I tried putting in the tag with classid and everything, but then I get a "object not defined" error when I run the javascript (i.e, if the object has id "objectTest" and one of the methods in the activex object is displayRandomText, I get the error on the javascript: "objectTest.displayRandomText();"). How can I make it so the client can automatically register the activex object without having to do it manually using the regasm command (i.e. regasm testObject.dll /tlb:testObjectNet.dll /codebase)?
The reason that it's not creating the object is cos COM (ActiveX) uses the registry to map class IDs to filenames. When you register a component, the mapping is added into the registry under HKEY_CLASSES_ROOT. Without the registration, the COM subsystem doesn't know where to find the dll that you want - doesn't matter if you give it a classid or a progid. If I remember correctly (and HIGH probability that I don't!) can specify a filename rather that a progid / clsid to CoCreateInstance...maybe someone more knowledgable could shed some light? May be possible to do something similar in *.js? "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox