Ask HN: Is there ever a reason to use ActiveX?

6 points by dec0dedab0de ↗ HN
Someone just adamantly suggested that we use ActiveX for a project, and my vitriolic gut feeling was "There is no legitimate reason to use ActiveX. Ever." But that made me curious, is there any situation you would use ActiveX over some other means?

7 comments

[ 2.7 ms ] story [ 30.7 ms ] thread
The short answer is: No, God, No!

The long answer is: Maybe. It depends on what you're going to do with it.

A web application? You shouldn't ever be using ActiveX at all. Some complex Windows-only browser plugin or something else that requires native code? Maybe. But even then, especially if this is a mass market product, you should seriously stop and step back and take a look at what you're trying to do.

Theoretically, in some kind of intranet office application that needed to access Windows or MS Office APIs. I'm having trouble coming up with a hypothetical example, but that's the sort of thing where it might make sense.
You shouldn't be touching Windows APIs from a browser applet, ever. Period. Whatever system does that should be rebuilt posthaste. With credit to @api - something like that is like driving drunk, an accident is inevitable.

Microsoft makes a C# library that handles MS Office API interop. If that were the task I'd look at a .Net desktop application - or an applet-type arrangement of some kind. Dropper page + .Net application? Dropper page + Applet page that communicates to a .Net wrapper layer? Silverlight maybe? Something like that.

Replace "use ActiveX" with "drive smashed-arse drunk" or "commit premeditated murder." Same answer.
I suggest parrying their ActiveX thrust with a counter-attack argument for NaCl.

https://developer.chrome.com/native-client

If you have to do something inside a browser, Native Client is much more interesting as something that started out as a really pretty darn clever x86 hack in the way that they could sandbox all of this in user mode interestingly. It's now dynamic recompilation, but something that you program in C or C++ and it compiles down to something that's going to be not your -O4 optimization level for completely native code but pretty damn close to native code. You could do all of your evil pointer chasings, and whatever you want to do as a to-the-metal game developer.

-John Carmack, OculusVR [1]

[1] http://www.youtube.com/watch?v=wt-iVFxgFWk&t=2h36m18s

In a previous job we had to make a plugin that could access win32 APIs for a bass ackwards set of companies who were determinedly sticking with IE6 or IE8. Their lockdown prevented the installation of proper desktop apps/services but allowed the installation of activeX (totally safe and secure, obviously). All the devs vehemently objected to ActiveX but couldn't actually come up with any viable alternatives other than turning down the business... If they had chrome or ff we could have probably gotten all we needed from the OS without directly using win32 (mostly desktop screenshot capture) or if they'd allowed us to ship them an msi to push to their machines we could have done a variety of other solutions... But alas, no.

So, I guess if your customers are in some insane semi-enterprise technology wasteland with impenetrable beurocracy and inscrutable "IT security" then yea, ActiveX might be a viable solution.

I quit after the plugin was repositioned to be our main offering above a semi-decent SAAS web service we offered. All aboard he ActiveX train! "The CEO can install ActiveX on his iPad right?"

I work with an electronic health records system that is coded in ActiveX applets and boy howdy is it bad.

Nowadays there is no legitimate reason to use ActiveX. Ever. Static web pages should be coded in RoR/Java/ASP.net, dynamic-type pages should integrate jQuery/AJAX/JSON, really dynamic pages and games go into something like NaCl or (ugh) Flash.