Export (0) Print
Expand All

COM Interoperability in Visual Basic and Visual C#

When you want to use COM objects and .NET objects in the same application, you need to address the differences in how the objects exist in memory. A .NET object is located in managed memory — the memory controlled by the common language runtime — and may be moved by the runtime as needed. A COM object is located in unmanaged memory and is not expected to move to another memory location. Visual Studio and the .NET Framework provide tools to control the interaction of these managed and unmanaged components. For more information about managed code, see Common Language Runtime.

In addition to using COM objects in .NET applications, you may also want to continue to develop COM objects using Visual Basic .NET or Visual C# .NET.

The links on this page provide information about the concepts and implementation details for interoperating between COM and .NET objects.

In the Visual Basic and Visual C# Documentation

COM Interop
Provides links to topics covering COM interop in Visual Basic, including COM objects, ActiveX controls, Win32 DLLs, managed objects, and inheritance of COM objects.
COM Interop Part 1: C# Client Tutorial
Shows how to use Visual C# to interoperate with COM objects.
COM Interop Part 2: C# Server Tutorial
Describes using a Visual C# server with a C++ COM client.
COM Interop Wrapper Error
Describes the consequences and options if the project system cannot create a COM interop wrapper for a particular component.

Additional Information

Interoperating with Unmanaged Code
Briefly describes some of the interaction issues between managed and unmanaged code, and provides links for further study.
COM Wrappers
Discusses runtime callable wrappers, which allow managed code to call COM methods, and COM callable wrappers, which allow COM clients to call .NET object methods.
Advanced COM Interop
Provides links to topics covering COM interop with respect to wrappers, exceptions, inheritance, threading, events, conversions, and marshaling.
Automating Office Applications
Provides information on using Microsoft Office and Visual Studio .NET as part of your business application.
Type Library Importer (Tlbimp.exe)
Discusses the tool you can use to convert the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly.
Show:
© 2014 Microsoft