views:

43

answers:

2

Ok, I'm pretty sure this is a stupid question so I apologise in advance.

I have never done anything with ActiveX, nor have I really got stuck in with what you can do with Flash/Silverlight, but what I am wondering is can either of these technologies be used to talk to external devices that are connected to a machine?

I guess what I am really asking is: If I have a machine with a non standard device attached, i.e. a bar code reader. Is the only way of accessing this device via off-line installable software?

Cheers, Chris.

+1  A: 

You can't access much of the client machine in Silverlight - it's a deliberate design choice to prevent malicious actions. You can read files and download files, but you can't execute anything outside the Silverlight application.

To access a device such as a bar code reader you will need to install some software on the client machine - and you can't do that from Silverlight.

I don't know enough about ActiveX or Flash to be able to answer for those.

ChrisF
And with ActiveX? I know this is fast becoming depreciated technology, but it was my understanding that this wasn't bound by the same sandboxed environment?
Owen
I was only answering for Silverlight - I've not done enough ActiveX (and it was a few years ago now) to be able to answer with any certainty.
ChrisF
No worries, thanks for confirming my thoughts on Silverlight.
Owen
+2  A: 

An ActiveX control, once the user has allowed it to install and run, can do anything that a native Windows application can do.

(Flash and Silverlight are sandboxed, and can't access devices belonging to the client PC.)

RichieHindle
Thanks Richie, that's what I thought. So here's what Do we know why the other technologies I listed have been sandboxes with no further support for ActiveX type freedom without diving into with COM development.
Owen
Flash and Silverlight are sandboxed so that people will install them. ActiveX is a dangerous technology, and people are quite rightly unwilling to install arbitrary ActiveX controls. If Flash and Silverlight were as unrestricted as ActiveX, few people would install them. "With great power comes great responsibility" and people don't trust the Internet to behave responsibly. (It's bad enough that Flash has been repeated guilty of introducing security holes into people's browsers, without it doing so explicitly by allowing arbitrary access to people's PCs!)
RichieHindle
Ok, I understand the security risks, and I can see the commercial reason for Flash/Silverlight wanting to present a secure face to the world. But, there are very legitimate reasons for software that operates at a higher security level in the browser. Do you know if there are any plans from MS to replace ActiveX with another programing model?
Owen
Not that I'm aware of, no. The idea of embedding arbitrarily powerful (and hence arbitrarily dangerous) software into a web browser is getting less and less attractive as time goes by. Microsoft aren't likely to release a new technology that allows that. On the plus side, there are a lot of people relying on ActiveX, particularly in corporate environments, and it's not likely to go away any time soon. And Visual Studio with MFC or ATL makes it relatively easy to write an ActiveX control without needing to be a COM wizard.
RichieHindle
@RichieHindle, thanks for this off topic discussion, i know its not the question but its helping me undertand a fair bit more about this area. If you'll entertain me a little more I'd appreciate it.It was my understanding that ActiveX is no longer actually supported by MS, are you saying this is not the case? Also, you seem to know a fair bit about ActiveX development through Visual Studio, any pointers as to where I'd get started with all this?
Owen
ActiveX is well supported up to and including IE8. The number and scariness of the dialogs that the user has to OK in order for a control to be installed has increased over the years, but it's still going strong. As for Visual Studio, there are wizards for creating ActiveX controls in both MFC and ATL - go File / New Project / C++ / MFC / MFC ActiveX Control or C++ / ATL / ATL Project.
RichieHindle
Cheers Richie, thanks for all your time, wish I could up vote more.
Owen
No problem - happy to help!
RichieHindle