Check Order status | Verified Sales | Escrow Service | Advertise
westernunion carding gold carding
revolut carding electronics carding
paypal carding payoneer carding
advertise on cracking forums

Programming with COM


[ Verified Seller ]
Staff member
Trusted Seller
10 yrs. 8 mth. 12 days
Reaction score
Programming with COM

Ajay Yadav July 10, 2013


This article commences by taking a brief backward glimpse at COM then compares it with the way that components interact in .NET, and finally it takes a look at the tool provided by Microsoft to let these two technologies coordinate together. Essentially, COM is the antecedent technology to .NET. COM defines a component prototypical where components can be written in dissimilar programming languages. In addition to, they can be cast-off inside a process, across a process or across the network (DCOM). But the COM technology became more and more complicated in terms of implementation and turn out not to be extensible enough. However, the .NET justifies the similar goals as COM had, but introduces new conceptions to make job easier.


In order to, implement COM components interoperability with .NET framework, following stuffs are required;

Visual Studio 6 with VC++ (optional)
Visual Studio 2010 with VC++.Net features


Before delving into .NET-COM interoperability, it is important to be aware about legacy COM (Component Object Model) itself. COM was Microsoft’s first attempt at creating a language- independent standard for programs, the idea was that interfaces between components would be defined or invoked according to a binary standard. This would have inferred that you could invoke a VC++ component from a VB application and vice versa. A COM component implements one or more interfaces which defines the various methods that an application may invoke during marshaling.

COM in Practice

To see how a .NET application can use a Legacy COM component, you first have to create a COM component using VC++ because creating COM component is not possible with C# or;

1.To create a COM component with ATL and C++, create a new ATL project. Set the name to comServerTest and with application setting, select Dynamic Linking Library, and finally click Finish.


2.The first thing, you have to define the class as mathLib then place the methods Addition() and Square() definition in the ImathLib interface. Once this is done, look at the comServerTest.idl file which depicted all the methods definition as;

Please, Log in or Register to view codes content!

3.Now implement the business logic of those methods into the mathLib.cpp class as:

Please, Log in or Register to view codes content!

4.Finally build the component. The build process also configures the component in the registry.

If you are developing your client .NET application on the same machine, you don’t need to manually register it. However, if you are working entirely on a new machine, you need to register this component with regsvr32.exe utility as:


.NET Interoperability

The mechanism where data passed from COM components to .NET and vice-versa is called marshaling. The foremost concern during this process is the conversion of passed data types because, both technologies have different data type’s definition schemes. But .NET and COM have a common representation for some data types such as int, long, short and byte where conversion isn’t required during marshaling, is called Blittable data types.

In nonblitabble data types the conversion is required during data pass because these data types have a higher overhead. The following table lists some nonblittable to related blittable types as:


You can use the previously created COM component, comServerTest.dll from within the .NET application. We are going to implement the COM component method within a Windows Form project. First, we add the reference of the COM component then instantiate the MathLib class to invoke the methods.

1.Create a C# Window Form project name as comServerTestClient.
2.Design the form with appropriate control as following;


3.Add the COM component reference as the following;


4.Place the following code for a “both button” click event as:

Please, Log in or Register to view codes content!

5.Finally compile, and run the application.

Runtime Callable Wrapper

In the preceding example, we have done lots of activities. Every time you create a default interop assembly by importing COM dll into Visual Studio. So, it might be better to do a wrapping once, and then let your application import the resulting .NET assembly instead of a COM component. The RCW would spare the hassle of repeatedly dealing with COM characteristics because it hides the IUknown and IDsipatch interface and deals with the reference count of the COM object.

RCW can be created by using the command line utility tlbimp.exe; here, we are creating a new.dll from the COM component which contains a .NET assembly with the wrapper class as following:


COM Callable Wrapper

So far, we have seen how to access a COM component from a .NET application with RCW. Equally interesting is to find a solution for accessing .NET component from a COM client by using COM Callable Wrapper (CCW)

In the following example, we create a simple C# class library project. Then add some interface to define methods which are invoked from a COM client.

Please, Log in or Register to view codes content!

Now compile this class library project. Before the, .NET components can be used as a COM object. It is necessary to configure it in the registry you can use the regasm.exe utility to configure the components inside the registry as:


Now open the Visual Studio command prompt to create a COM wrapper class using tlbexp.exe utility as the following:


As you notice in the directory of the solution, NewLib.tlb file created after executing tlbexp.exe command. You can view the type library with OLE/COM object viewer utility, which resides in Visual Studio Tools as:


In the generated code, you can see that the interface ITest are defined as COM interface and all the methods defined in the C# code are listed here in the type library.


ActiveX controls are COM objects with a user interface. They are used by many different containers such as Word, Excel, IE and Windows Forms. Similarly, to RCW, we can also create a wrapper for ActiveX controls using aximp.exe command line utility.



In this article, you have learned how the .NET application interoperates with COM and vice-versa using RCW and CCW. You also come across with couple of underlying utilities such as tlbimp to import type library, tlbexp to export type library from .NET assemblies, regasm and regsvr32 to register a .NET component in register. You also incorporate the ActiveX control into the .NET user interface.

Please, Log in or Register to view URLs content!
Paid adv. expire in 2 months
CLICK to buy Advertisement !
westernunion carding Verified & Trusted WesternUnion | MoneyGram | Bank - Transferring [299$ BTC for 2000$ WU]
electronics carding Verified & Trusted Electronics Carding, Carding iPhone, Samsung Carding, MacBook Carding, Laptops Carding
Top Bottom