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

How will you do windows authentication and what is the namespace? If a user is logged under integrated windows authentication mode, but he is still not able to logon, what might be the possible cause for this? In ASP.Net application how do you find the name of the logged in person under windows authentication?

551


Explain the concept of MVC Scaffolding?

595


What are assemblies and namespaces and explain the difference between them ?

570


Where session id is stored?

537


What is the viewstate in asp.net?

573






What is http post and http get?

546


What is asp.net caching?

578


Define the types of configuration files.

532


What’s the catch?

626


Explain client side state management system.

570


Mention the execution process for managed code?

539


explain code with multi inhertance

1651


What are themes and skins in 2.0, explain usage scenario?

526


When you use Ajax controls in the ASP.NET application?

570


What is a server farm in iis?

539