Importing and Using COM Objects

The .NET Framework 4.0, like previous versions, offers support for interoperability with the COM architecture via an engine named Runtime Callable Wrapper, which is the infrastructure that provides a communication bridge between .NET and COM. It is also responsible for type marshaling and handling events. Because of this engine, you can import COM objects and use them in your managed applications. Basically you can import two kinds of COM components: type libraries and ActiveX components. Importing COM components is basically accomplished via two command-line tools: TlbImp.exe, which is required to import a type library, and AxImp.exe, which is instead required for importing ActiveX controls. This chapter does not discuss how to invoke such tools from the command line, whereas you instead see how to import COM components from within Visual Studio so that the IDE can do the work for you. In the next example you see how to import an ActiveX control into the Visual Studio toolbox and use the control in code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.42.81