what is COM Object in Dot net?

Answer Posted / srividya_gopalan

Component Object Model is a method to facilitate
communication between different applications and languages.
The following steps explain the way to create the COM
server in C#:

Create a new Class Library project.
Create a new interface, say IManagedInterface, and declare
the methods required. Then provide the Guid (this is the
IID) for the interface using the GuidAttribute defined in
System.Runtime.InteropServices. The Guid can be created
using the Guidgen.exe. [Guid("3B515E51-0860-48ae-B49C-
05DF356CDF4B")]
Define a class that implements this interface. Again
provide the Guid (this is the CLSID) for this class also.
Mark the assembly as ComVisible. For this go to
AssemblyInfo.cs file and add the following statement
[assembly: ComVisible (true)]. This gives the accessibility
of all types within the assembly to COM.
Build the project. This will generate an assembly in the
output path. Now register the assembly using regasm.exe (a
tool provided with the .NET Framework)- regasm
\bin\debug\ComInDotNet.dll \tlb:ComInDotNet.tlb This will
create a TLB file after registration.
Alternatively this can be done in the Project properties ->
Build -> check the Register for COM interop.
The COM server is ready. Now a client has to be created. It
can be in any language. If the client is .NET, just add the
above created COM assembly as reference and use it.

Is This Answer Correct ?    24 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write some code using interfaces, virtual methods, and an abstract class`

1826


Explain the asp.net page life cycle.

785


Which ASP.NET configuration options are supported in the ASP.NET implementation on the shared web hosting platform?

859


What is the difference between custom web user control and a custom web server control?

707


Is asp.net 64-bit enabled? How?

814


What do you mean by authorization?

716


Which is the parent class of the ASP.NET server control?

753


In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?

750


How is session id generated?

655


What is scope of an application variable in asp.net?

720


Where do we store our connection string in asp.net application?

750


What websites use asp.net?

735


What is loop in asp.net?

803


What is the significance of finalize method in .net?

772


Using code explain Configuration Management

1616