tags:

views:

32

answers:

3

We have a website that is based on C# and ASP.NET, I have a barcode scanner with a .dll file to control it that I can get to work in VB6. Before I dig deeper in exactly how to do this I wanted a quick answer on if it is even possible to do what I want first.

Can I write an activex control in VB6 that will allow me to control the barcode scanner and implement that activex control in our .NET based website?

Just to be clear, not asking HOW to do it, just asking if it can be done. I haven't done any ActiveX programming before and haven't touched VB6 in a long time.

Thanks!

A: 

I believe it should be possible; but you will probably need to implement it with JavaScript and ActiveX objects. This will require that the user's browser is setup to allow your web site to interact with ActiveX objects. A simple example of this, is using a link to start a program (like remote desktop client):

<script type="text/javascript">
    function runMstsc() {
        var command="mstsc.exe /v:127.0.0.1 /w:1024 /h:768";
        var scriptHost = new ActiveXObject("WScript.Shell");
        scriptHost.run(File);
    }
</script>

Assuming that your application is a valid ActiveX control, you should be able to minipulate it in a similar fashion to WScript.Shell.

Nate Bross
Awesome! Thanks for the quick replies! Knowing that I should be able to do this will turn my focus on making this method work.
Chris R
A: 

ActiveX controls are client-side components installed on the user's machine. They are then hosted inside the browser. So yes, if the scanner is hooked up to a client machine you could access it via the ActiveX control. You would then have to use some assortment of AJAX/XML/JavaScript to send the data back to the server.

DancesWithBamboo
A: 

Most users are going to see fearsome security warnings because their browser distrusts your ActiveX control. If anything detects the control using a device driver, I think the security warnings will go nuclear.

Have you considered staying with a separate desktop application, communicating with the website via web services? You could use ClickOnce deployment so that the user doesn't have to run an install or login as administrator.

MarkJ
We have discussed those options but we don't really want to go that route. We will if using an ActiveX control option does not work for us. Our clients will have no problem installing an activex control since they had to install another already. This is a private site, not public.
Chris R
On a private website the ActiveX control should be OK
MarkJ