views:

975

answers:

1

Hi All,

I'm trying to create an Active X component that will start an application on a client machine. I've created an Active X control which is quite straight forward in .NET. ALl it does is call the Process class and call Start.

Now i want to be able to call the starting method on this class from javascript passing in a few parameters on the page (which are then passed down as command line arguments).

I followed the guide here: http://www.c-sharpcorner.com/UploadFile/mgold/HyperlinkExec03012007191054PM/HyperlinkExec.aspx

This guide talks about using a hyperlink to start the javascript but i'm using a button. Here is my HTML (i'm trying this in just plain HTML instead of ASP.NET to keep things simple for now but i want to go to ASP.NET eventually)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" >

    <body>
        <button type="button" onclick="javascript:launch()">Click me!</button>
        <script type="text/javascript">
            function launch()
            {
                alert('test')
                var myLauncher = new ActiveXObject('CardWriterApplicationLauncher');
                myLauncher.LaunchCardWriter('test', 'test', 'test');
            }
        </script>

    </body>
</html>

How when i click the button i get the error "Automation server can't create object". I know that my COM dll is registered properly in the GAC and with regasm, so what could i be doing wrong?

Also any alternative solutions to launching the application on the users desktop from a web page would be greatly appreciated. Browser security setting can be modified as required as the client PCs are under our control and are on a private network with no internet access.

Thanks

A: 

If you have public properties or methods in the ActiveX control can you not just call those directly referencing the <Object>'s ID using JavaScript?

So the ActiveX control is already loaded on the page using the <object> tag, and you're just calling its method.

Mark Redman
How would i go about using the object tag. I've seen some information about it, but never managed to get it to work.
Search for how to embed an activeX control in an hmtl page see: http://www.fpoint.com/support/whitep/ActiveX/ax1999.aspx This will display control on the page (in your case, it might not have an interface, but you can add one to test it) Once you have the control on the page you can then start interacting with it using javascript.
Mark Redman