How to use DLL reference with an ActiveX <object> via JavaScript

Posted by John Factorial on Stack Overflow See other posts from Stack Overflow or by John Factorial
Published on 2010-06-14T18:19:17Z Indexed on 2010/06/14 18:22 UTC
Read the original article Hit count: 312

Filed under:
|
|
|
|

My question: how can I set an ActiveX object's property via JavaScript to an enum value found in a non-ActiveX DLL?

Problem description:

I am instantiating an ActiveX object with the following object tag:

<object classid="clsid:F338193D-2491-4D7B-80CE-03487041A278" id="VideoCapture1" width="500" height="500"></object>

(This is the guid for the 3rd party ActiveX I'm using, "VisioForge_Video_Capture_4.VFVideoCapture4X")

I have example C# code for using this ActiveX, which I am porting to JavaScript. Code like this works just fine:

VideoCapture1.Debug_Mode = true;
var devcount = VideoCapture1.Video_CaptureDevices_GetCount();
var devs = [];
for (var i =0; i < devcount; ++i) {
    devs[devs.length] = VideoCapture1.Video_CaptureDevices_GetItem(i);
}
... etc ...

However, VideoCapture1 has some settings which refer to a DLL enum, like so (C# code):

VideoCapture1.Mode = VisioForge_Video_Capture_4.TxVFMode.Mode_Video_Preview;

I can see in Visual Web Developer that TxVFMode.Mode_Video_Preview is value 1 in the enum. However, the following JS does not appear to set the Mode properly:

VideoCapture1.Mode = 1;

Does anyone know how I can set VideoCapture1.Mode to the enum value found in the TxVFMode?

PS: In Visual Web Developer, when I "Go to definition" on TxVFMode, I get the Guid for the enum. I thought I could create an with this Guid or instantiate a VisioForge_Video_Capture_4.TxVFMode in JS, but neither gives me a usable object.

© Stack Overflow or respective owner

Related posts about c#

Related posts about JavaScript