1
votes

I want to access methods and properties on an Activex DLL that I have created in VB6

Just some back ground... The VB6 DLL has the project name called PDFViewer and I have a single class clsPDFViewer. In the class there are methods and properties that I wish to use.

I am using javascript with IE9.

Basically in javascript I have made a reference to the object

Attempted two ways

var PDFViewer = new ActiveXObject("PDFViewer"); var PDFViewer = document.getElementById("PDFViewer");

An error keeps occuring saying that it cannot create ActiveX Even if I get past this error..

When i try something like this

alert(PDFViewer.Page);

then the other error is that the properties or methods do not exist can someone please help

I am new to javascript.. please be patient Its frustrating when I try one way is doesn't work for one reason and then when I try another way is doesn't work for someother reason grrrrrr...

1
new ActiveXObject requires that the COM/ActiveX DLL be registered with the system. As VB6 is a 32-bit system it means you also have to be running the 32-bit version of IE. Is this the case?Dai
Yes. Every time this ActiveX DLL is compiled with binary compatability, it gets registered automatically and the clsid remains constant.Lorenzo Barone

1 Answers

1
votes

This is due to security restrictions in IE. The minimum dependency is that the DLL is registered on the client. (The VB6 IDE will do this if compiling on the same machine as testing, otherwise use the Rgsvr32 command to install the DLL on the client.)

Then you can either add the URL/domain hosting your page attempting to use the DLL to IE's "Trusted Sites" zone and/or you can enable ActiveX scripting for other internet zones. (Although the latter will leave your browser in an unsafe state and constantly annoy you with messages about such!)