I need to remotely load a .NET DLL containing an ActiveX object (non-visual) and then access it through javascript using the new ActiveXObject () method.
IE8 currently correctly loads this DLL using the path from the codebase attribute of the object tag, but ActiveXObject does not work because the ActiveX loader does not find the DLL in the registry.
I use ProcMon to track events that occur, and can check if the DLL is loading and that the registry is being examined by the new ActiveXObject method. this second part does not work, although the ActiveX object is not in the registry.
<body> <object name="Hello World" classid="clsid:E86A9038-368D-4e8f-B389-FDEF38935B2F" codebase="http://localhost/bin/Debug/Test.ActiveX.dll"> </object> <script type="text/javascript"> var hw = new ActiveXObject("Test.ActiveX.HelloWorld"); alert(hw.greeting()); </script> </body>
If I use regasm , I can provide the necessary registrations, and then it all works, however I do not want to deploy the installer for this purpose. I understand that IE must register the DLL for me - I just don’t know Know what this does.
The .NET class has the necessary attributes to make all this work in regasm, but it seems the registry code is not being called. (Registration code was taken from here )
namespace Test { [Guid("E86A9038-368D-4e8f-B389-FDEF38935B2F")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] [ComVisible(true)] public interface IHelloWorld { [DispId(0)] string Greeting(); } [ComVisible(true)] [ProgId("Test.ActiveX.HelloWorld")] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(IHelloWorld))] public class HelloWorld : IHelloWorld { [ComRegisterFunction()] public static void RegisterClass(string key) {
source share