0% found this document useful (0 votes)
42 views

Program and Steps For Compilation and Running ActiveX Control

The document provides 7 steps to compile, register, and run an ActiveX control written in C# within a web page using Internet Explorer: 1. Write the ActiveX control code in C# and save it. 2. Compile the code to generate a library. 3. Register the library to make the control available. 4. Create an HTML page that instantiates the control and calls its methods and properties. 5. Open the HTML page in Internet Explorer and allow blocked content to run the ActiveX control.

Uploaded by

Sobhan Dasari
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Program and Steps For Compilation and Running ActiveX Control

The document provides 7 steps to compile, register, and run an ActiveX control written in C# within a web page using Internet Explorer: 1. Write the ActiveX control code in C# and save it. 2. Compile the code to generate a library. 3. Register the library to make the control available. 4. Create an HTML page that instantiates the control and calls its methods and properties. 5. Open the HTML page in Internet Explorer and allow blocked content to run the ActiveX control.

Uploaded by

Sobhan Dasari
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Steps for compilation and running ActiveX control 1.

Write the code for ActiveX control using notepad and name it as AClass.cs AClass.cs using System; using System.Runtime.InteropServices; namespace ANamespace { public interface ASignatures { string FName(); string SName(); int Age { get;} } [ClassInterface(ClassInterfaceType.AutoDual)] public class AClass :ASignatures { public string FName() { return "I"; } public string SName() { return "N"; } public int Age { get { return 249; } } } }

2. Save it in C:\Program Files\Microsoft Visual Studio 9.0\VC folder 3. Open visual studio 2008 command prompt from start -> all programs 4. To compile the ActiveX control type csc /t:library AClass.cs 5. To register the component type regasm AClass.dll /tlb /codebase

6. Now open another notepad file and enter the javascript code to invoke the component and save it as Activex1.html on Desktop Activex1.html <html> <head> <script language="javascript"> <!-- Load the ActiveX object --> var x = new ActiveXObject("ANamespace.AClass"); <!-- Access the Method --> alert(x.FName()); alert(x.SName()); <!-- Access the Property --> alert(x.Age); </script> </head> <body> </body>

7. Open the ActiveX.html using internet explorer 8. Right click on the yellow ribbon to allow the blocked content

You might also like