ActiveX control is a special type of COM component that supports a User Interface. Using ActiveX Control in your .Net Project is even easier than using COM component. They are bundled usually in .ocx files. Again a proxy assembly is made by .Net utility AxImp.exe (which we will see shortly) which your application (or client) uses as if it is a .Net control or assembly.
. Making Proxy Assembly For ActiveX Control: First, a proxy assembly is made using AxImp.exe (acronym for ActiveX Import) by writing following command on
This command will make two dlls, e.g., in case of above command
The first file MyControl.dll is a .Net assembly proxy, which allows you to reference the ActiveX as if it were non-graphical object.
The second file AxMyControl.dll is the Windows Control, which allows u to use the graphical aspects of activex control and use it in the Windows Form Project.
. Adding Reference of ActiveX Proxy Assembly in your Project Settings: To add a reference of ActiveX Proxy Assembly in our Project, do this:
.Select Project?d Reference. (Select Add Reference from Project Menu).
. This will show you a dialog box, select .Net tab from the top of window.
. Click Browse. button on the top right of window.
. Select the dll file for your ActiveX Proxy Assembly (which is MyControl.dll) and click OK
. Your selected component is now shown in the 'Selected Component' List Box. Click OK again
Some More On Using COM or ActiveX in .Net
. .Net only provides wrapper class or proxy assembly (Runtime Callable Wrapper or RCW) for COM or activeX control. In the background, it is actually delegating the tasks to the original COM, so it does not convert your COM/activeX but just imports them.
. A good thing about .Net is that when it imports a component, it also imports the components that are publically referenced by that component. So, if your component, say MyDataAcsess.dll references ADODB.dll then .Net will automatically import that COM component too!
. The Visual Studio.NET does surprise you in a great deal when u see that it is applying its intellisense (showing methods, classes, interfaces, properties when placing dot) even on your imported COM components!!!! Isn't it a magic or what?
. When accessing thru RCW, .Net client has no knowledge that it is using COM component, it is presented just as another C# assembly.
. U can also import COM component thru command prompt (for reference see Professional C# by Wrox)
. U can also use your .Net components in COM, i.e., export your .net components (for reference see Professional C# by Wrox).