Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Active X Control JavaScript

My coworker and I have encountered a nasty situation where we have to use an active X control to manipulate a web camera on a page.

Is it possible to assign a javascript event handler to a button in the active x control so that it would fire an action on the page when clicked, or do we have to create a button on the html page itself that manipulates the Active X Control and then can fire any necessary actions on the page?

like image 310
kemiller2002 Avatar asked Aug 25 '08 18:08

kemiller2002


People also ask

What has replaced ActiveX?

Microsoft dropped ActiveX support from the Windows Store edition of Internet Explorer 10 in Windows 8. In 2015, Microsoft released Microsoft Edge, the replacement for Internet Explorer with no support for ActiveX, this event marked the end of ActiveX technology in Microsoft's web browser development.

Is ActiveX obsolete?

As the web has advanced to distributed and more secure technology stacks, ActiveX should naturally be deprecated. Based on important industry trends, NetDocuments will terminate support for Internet Explorer and ActiveX, effective August 31, 2020 (the “Effective Date”).

Is ActiveX still supported?

As of 2021, ActiveX controls are still supported on modern versions of Windows 10. You have to use the legacy Internet Explorer 11 browser, however—Microsoft Edge does not support ActiveX controls.

What is ActiveX control used for?

ActiveX controls are component program objects that Microsoft developed to enable applications to perform specific functions, such as displaying a calendar or playing a video. An ActiveX control is a small program that other applications can reuse to enable the same functionality, without the extra development work.

How do I enable ActiveX controls?

How to Enable ActiveX Controls 1 Click Tools > Internet Options. 2 Click the Security tab > Custom Level. 3 Scroll down to ActiveX controls and plugins and click Enable for:Run ActiveX controls and plugins.Script ActiveX controls marked safe for scripting. See More....

What is the HTML Help ActiveX control type?

The HTML Help ActiveX control TYPE is application/x-oleobject. Uniquely identifies the HTML Help ActiveX control from other ActiveX controls. The HTML Help ActiveX control identifier is the registry key number and is the same for every instance of the control that you use.

What is ActiveX scripting?

Simply dropping ActiveX controls onto your Web page isn't enough for you to build a dynamic and exciting Web page. You have to make all those controls work together. That's where scripting comes in. You associate scripts with the events and values of the controls you put on a Web page so that you can make them interact.

How do I sign the ActiveX application?

To sign the ActiveX application, we package the components of the application into a CAB file, which is downloaded from the web site and the ActiveX control is installed on the system. Part of installing the ActiveX control requires registering the control.


2 Answers

Please just use an existing ActiveX control. Like Flash or Silverlight. Flash has built-in webcam support and is controllable via JavaScript. Silverlight doesn't have built-in camera support, but it's JavaScript integration is fantastic.

If you must write your own then fret not, it is trivial to get it to interact with JavaScript. You just have to expose the IDispatch interface.

For events, you need to learn about Connection Points.

like image 123
Frank Krueger Avatar answered Oct 11 '22 11:10

Frank Krueger


Yes! You can throw events in C++/ActiveX land which makes the JavaScript code run an event handler function. I was even able to make an entire invisible ActiveX control (same color as page background) with no buttons or visual feedback that did all of its GUI work through JavaScript and CSS.

edit: Frank's advice is right on. Here's the link on scripting events.

My strategy was to call a C++ function called MyUpdate (which implements IConnectionPoint) when I wanted to force updates in the browser.

(Also, I made sure to pump Windows messages in the Fire_MyUpdate method because sometimes JavaScript code would call back into C++ land by calling methods on the ActiveX control; this avoids freezing up the browser and ensures that the JavaScript GUI stays responsive, e.g. for a Cancel button.)

On the browser side, the JavaScript code has the global variable referencing the object, followed by "::", followed by the method name:

function Uploader::MyUpdate()
{
    // ... code to fetch the current state of various
    // properties from the Uploader object and do something with it
    // for example check Uploader.IsActive and show or hide an HTML div
}
like image 30
Jared Updike Avatar answered Oct 11 '22 10:10

Jared Updike