Using ActiveX Controls in Windows Forms C# Help

ActiveX controls are COM objects with a user interface and many optional COM interfaces to deal with the user interface and the interaction with the container.

ActiveX controls can be used by many different containers, such as Internet Explorer, Word, Excel,and applications written using Visual Basic6.0,MFC (Microsoft Foundation Classes), or ATL(Active Template Library).

A Windows Forms application is another container that can manage ActiveX controls.

ActiveX controls can be used similarly to Windows Forms controls as you’ll see shortly.

ActiveX control importer

Similar to runtime callable wrappers, you can also create a wrapper for ActiveX controls. A wrapper for an ActiveXcontrol is created by using the command-line utility Windows Forms ActiveX Control Importer, aximp. exe. This utility creates a class that derives from the base class System.windows.Forms.AxHost that acts as a wrapper to use the ActiveXcontrol.

You can enter this command to create a wrapper class from the Web Forms control: aximp c:\windows\system32\shdocvw.dll
ActiveXcontrols can also be imported directly using Visual Studio.

If the ActiveX control is configured within the toolbox, it cah be dragged and dropped onto a Windows Forms control that creates the wrapper.

Posted on October 27, 2015 in Interoperability

Share the Story

Back to Top