Run activex on client machine

Posted on 2004-11-09
Last Modified: 2013-11-18
Hi, totally newbie on activex controls, but I do know .asp.

I have an .asp application and I have made an activex-component that I want to access on the client machine. A also need to pass a variable to the client.

See this for info on the activex-component I have made..

The page runs on a hosted server.

Question by:wahooo
    LVL 15

    Expert Comment

    Running an activex control on the clients machine is very difficult because of browser security. Default browser security doenst allow activex contorls becuase they could be potentionally harmful

    but you, i you want to embadd the axtivex you need to use the html <object> tag.

    Or if you want ot create it using javascript you would use new ActiveXObject( "name goes here" );

    I do believe your looking to embadd the object

    btw i know i spell horribly

    Author Comment

    ok, how do I for instance make a .dll file to put on the server that can do the same..

    and is this better..`?

    need code and help though..
    for 500p..

    LVL 12

    Expert Comment

    here's what i do to embed ActiveX object in my asp page:

    1.  use Visual Studio "Package and Deployment wizard" to create the .CAB package
    2.  to place this object in the asp page, add something like this to your asp page:

    <object ID="objTest" CLASSID="CLSID:xxxx-xxxxx-xxxxx-xxxxx" codebase="http://mySite/ActiveXObject/test.CAB#version=1,0,0,0" VIEWASTEXT>

    The object ID is the name you can referred to in Javascript using getElementById(), and then you can call public functions in your activeX object like this:  objTest.MyFunction();
    codebase tells the location in which the client machine can download the ActiveX object (.CAB).


    alternatively, you can try COM object.  With COM object you just need to compile it into .dll and register the dll to your server.  but if it is something that cannot be done using asp, the it is likely you won't be able to do it using COM dll either.  Only activeX object is like a real VB application.

    To use activeX object, you need to make sure the client machine's security is setup to allow activeX object to run.  If you are using adodb connections in your activeX object to query the database, you might run into "msado" incompatibility issues which is a pain in the @$$ to fix, otherwise it shouldn't be too much trouble.


    Author Comment

    Ok, Kingsfan

    I will try this later today, but what about passing a variable to the ActiveX-control?

    Like for example:
    Private Sub UserControl11_CallShell(PhNo As String)
       shell "c:\program files\x-pro\x-pro.exe " & "12345678"
    End Sub

    Is this possible to have on the .asp page and pass this to the activex-control?

    the number will change for every time..

    LVL 12

    Accepted Solution

    yes you can pass values from your asp page to the activeX through function calls in javascript.
    notes that the <object> tag will only load the activeX object, it will not run any sub/functions until you call them.  But i believe the sub or function must be declare public in order to be called from outside.  so if you want to keep UserControl11_CallShell as a private function, you can write another public or sub function to call it:
    public sub getInfo(num as string)
    end sub

    Private Sub UserControl11_CallShell(PhNo As String)
       shell "c:\program files\x-pro\x-pro.exe " & "12345678"
    End Sub

    then in your asp page, you can use javascript to call it:

    var objActiveX = document.getElementById("objTest");
    objActiveX.getInfo("12345678");   //invoke the public sub in the activeX object

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
    The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now