tags:

views:

1039

answers:

2

I've been able to create a small activex control, but it requires the dll to be registered on the client (using regasm).

How can i avoid this registration problem?

I'm attempting to write an activex control that is delivered over the web (to IE browsers) that will access the clients webcam (using directshow).

Here's my simple control:

  using System;
  using System.Runtime.InteropServices;
  namespace HelloNS
  {
      public interface IHello
      {
        string Message();
      }

      [ClassInterface(ClassInterfaceType.AutoDual)]
      public class Hello : IHello          {
        public string Message()
        {
            return "hello";
        }
      }
   }

And here's my viewer:

<html>
<head>
  <script language="javascript">
    var x = new ActiveXObject("HelloNS.Hello");
    alert(x.Message());
  </script>
</head>
<body>
</body>
</html>

I'm currently reading this on msdn: http://msdn.microsoft.com/en-us/library/aa751970(VS.85).aspx

If i figure it out i'll post the results.

+1  A: 

COM objects, when created by name, are instantiated by registration information stored in the Windows Registry. Even though your control is created in .NET it uses COM Interop to work with the browser. There's no way to create it by name without first registering it on the user's machine.

You might be able to get away with some sort of ClickOnce type delivery system that makes the installation on the client simple - but in all cases it must be registered.

Paul Alexander
+1  A: 

The Dynamic Language Runtime (DLR) and the interop advances being introduced with VS2010 and .NET 4.0 should make this much much easier. No COM interop required, no registration, etc. Here's Anders Hejlsberg describing how it works.

Have you tried this on .NET 4.0? The beta's are available.

I'm not sure of the security implications of accessing a webcam from the browser. But getting from Javascript to C# should be easy.

Cheeso