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

What is the default Orientation property in a Menu control?

533


How do u deploy your asp.net application?

610


What are Master Pages in ASP.NET?

571


Explain the different parts that constitute ASP.NET application?

563


What is the use of session state and application state and difference between them?

479






Explain the difference between singleton and single call?

532


What is asp.net with mvc? : Asp.Net MVC

516


Explain how asp.net page works?

541


What's the use of response.output.write()?

758


Dataset is the disconnected environment. suppose if you are binding records to gridview (disconnected environment) and you are making changes to the the grid but before updating the database if any other user modify the data, how will you avoid such problem?

1715


What is the difference between adding reference in solution explorer and adding references by using ?

570


What is the difference between dispose() and finalize()?

493


Define web.config in .net?

637


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net?

521


What are the namespace classes used in asp.net mvc? : asp.net mvc

543