Home » MS OfficeRSS

HOW TO CREATE ACTIVEX DLL USING C#

Hi

    I want to create an Activex using c# (Not Activex Control).The dll to contain only a plain class with some properties and methods.And i want to invoke the Dll class from Webpage(Html,JSP) using <OBJECT> Tag.I will pass the Params for setting the properties values.

How can i do it any suggestions or any reference for it.

(Its only the c# DLL File i want ).

How do we call a dll function on client side from web browser ?

Any help would be appricated.

Thanks & Regards

Dwipayan Das

 

13 Answers Found

 

Answer 1

Hello,

File->New->Project->Visual C# Projects->Class Library
Right click your project, click Add
Choose ClassLibrary from there..
It will create .dll..

Kind Regards..
 

Answer 2

ActiveX generally refers to ActiveX controls.  ActiveX without being a control is a COM object.  Any C# DLL is a COM Object by default; unless you add the attribute COMVisible(false).

There's some good tutorials about making C# classes COM visible, for example:

 

Answer 3

Thanks Peter,

I have already created the dll.How can i invoke the dll from HTML <Object> Tag .

Should i have to take Interface pattern for making this dll.

Thanks & Regards

Dwipayan Das

 

Answer 4

From memory, so if you have issues, post again...

Create a dll with a specified interface.  As an example:

namespace ExampleActiveX
{
  [Guid("[MAKE YOUR OWN GUID]")]
  [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
  public interface IMyExample
  {
    string FirstName;
    string LastName;
  }

 [ClassInterface(ClassInterfaceType.AutoDual), ComSourceInterfaces(typeof(IMyExample))]

 [Guid("[MAKE A DIFFERENT GUID]")]
 [ComVisible(true)]
 public class MyExample : IMyExample
  {
    private string firstName;
    [ComVisible(true)]
    public string FirstName
    {
       get { return firstName; }
       set { firstName = value; }
    }

    private string lastName;
    [ComVisible(true)]
    public string LastName
    {
       get { return lastName; }
       set { lastName = value; }
    }
  }
}

In your html/aspx page, include this to reference the object:

<object id="myExampleControl" height="100" width="100" classid="MyExample.dll#ExampleActiveX.MyExample">
</object>

You can reference the properties with javascript, for example

alert(myExampleControl.FirstName);

You can use functions as well as properties in your interface, too.  You can also generate events that you can respond to in javascript, but since you didn't ask about that, I won't include it and confuse the issue further.


 

Answer 5

Hi

   I am using a Classlibray Dll file which has more that 10 classes.I have sucessfully created CAB file for that.Now i have put the CAB File in JSP server(Weblogic).Now from client machine i requested a page called installDll.jsp and through object Tag is it installed on clinet machine.

Now  when i want to create an instance of that Dll its showing a runtime exception as Activex can't create Object.

Can you give some idea how can i register that dll on any client machine,without any explicitly registraion of dLL Method.

Thanks & Regards

 

Answer 6

Hi Mike Vallotton,
        I have used your approach to use C# method as ActiveX dll. 
How to create dll and register, I used  regsrv32 to register through command prompt. it gives me an error saying that dll is not an ActiveX dll.  thanks in advance.
 

Answer 7

Hi

Follow this link below and it will guide you create your Activex DLL in .NET and register and work with it.

http://www.codeproject.com/KB/cs/CreateActiveXDotNet.aspx


If you have any issue fell free to post reply.

You will have some problems with VISTA if you are deploying this Activex but i have also soved that issue.

Thanks

Das
 

Answer 8

hi,

We have an ActiveX control here that we've written with C# (.NET), and when we try and use it in a web page, the following message is shown in the IE7 "information bar":

 
"This website wants to run the following add-on: 'Control name is not available' from 'Unknown Publisher'.

Does anyone know how to have the name of our control and our company name show up there?

i have just created it using the tutorial http://www.codeproject.com/KB/cs/CreateActiveXDotNet.aspx .

I have signed the activex dll,still there is no use it dosnt show control name and publisher.
Is there any basic i have just dont meet while i created This activeX dll
Or do any one know from where the browser take the details from .
 

Answer 9

Hi,

Activex controls can contain virus so IE bydefault says it as Unknown Publisher when it prompt the user to install it and it shows this message when its not signed by any signing authority.

Just to test your component modify your IE Security Settings:

 1) Autometic Prompting for Activex-Make it enable
 2) Download Unsigned Activex control--Make it Prompt

Now save the IE settings and try again.

Thanks

--Dwipayan Das
 

Answer 10

Hi Dwipayan,

good evening,

me too having same problem like can't access activeX control from html/aspx pages. it displays empty box with RED color dot in small box on top-left corner.

can you tell me the steps how u have resolved. and also creating of CAB files and extracting them.

ur help z greatly needed

 

thanks in adv

madhav

 

Answer 11

Hi Peter

Please can you tell me how can i Create and use ActiveX Control for Web Pages

Please Dear ..help me

 

Thanks

 

 

Answer 12

Use activex control pad....if you want to create an activex control for the web pages...

 

dinesh.

dyani66@yahoo.com

 

Answer 13

Hi,

I had written an Article 'How to Create dll'

You can find my Article http://www.dotnetspark.com/kb/2654-creating-dll-file.aspx

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter