Library tutorials & articles

COM Interoperability in .NET Part 2

Introduction

This article elucidates how to build and install-managed code that will be used from COM applications. A classic COM server is activated using the Service Control Manager (SCM). It looks up numerous information such as CLSIDs, IIDs, ProgIDs etc.

So what is the solution to use the .NET assemblies in the classic COM clients,

These are the steps concerned in the build process are as follows:

  1. Write and compile the managed code.
  2. Generate a COM type library (*.tlb) for the assembly using the tlbexp.exe utility so that allow the COM client to interact with the exposed types.
  3. Install and register the assembly so that COM SCM to locate it.
  4. Write and compile the COM code that references types in the assembly.

For demonstration purposes, I have created a .NET component in C# named Calculator. For client side, I have created a Visual Basic (VB) 6.0-based client.

Comments

  1. 10 Jun 2006 at 03:39

    I AM A CHINESE,THIS IS MY FIRST TIME TO VISIT THIS WEB SITE~~~~

    I MAJOR IN COMPUTER,SOFTWARE,BEING A SOPHIMORE ,I AM SO DESIRABLE TO MAKE A FRIENDS WITH DIFFERENT COUNTRIES~~~~~

    I LIKE SPORTS,ESPECIALLY BASKETBALL,AND MUSIC,PLAYING GUITAR~~~~~~

    I LOOK FORWARD TO RECEIVING YOUR MESSAGE,MY EMAIL:CHARLES_ANDREW@163.COM

    THANKS ,A FRIEND FROM CHINA 

  2. 12 Apr 2006 at 01:07

    Hello, good news!!!

    I just figured out what was missing in what was reported in previous comment.

    In the Properties Pages of the .NET project, choosing "Configuration Properties" on the left panel, and then "Build", there is a switch labelled "Register for COM Interop", and of course it has to be set "ON", for all this to work as expected!!!!

    Well, let's keep working.!!!!

    Be well!!!!!

     

  3. 08 Apr 2006 at 00:38

    Hello, G.Gnana Arun:

    Hi, good day, greetings from Mexico City.

    Well, this post is to commet I just tried your implementation, I created a .NET DLL with VB.NET, then followed the .TLB file, just as you specify in your article, but at the moment of using the library in a VB 6.0 project, using the reference to the .TLB file, as you dictate, just when the object is to be instantiated, I receive a Num 429 error, "ActiveX Object can´t be created". I include here the code for the class in VB.NET:

    Public

    Class cDotNetUtilsVB60

    Public Shared Function IsPositiveInfinity(ByVal pdblNum As Double) As Boolean

    Dim lnuNumTem As Double

    Return lnuNumTem.IsPositiveInfinity(pdblNum)

    End Function

    Public Shared Function IsNegativeInfinity(ByVal pdblNum As Double) As Boolean

    Dim lnuNumTem As Double

    Return lnuNumTem.IsNegativeInfinity(pdblNum)

    End Function

    End

    Class

    Can you figure out what I'm doing wrong???????

    Thanks in advance, be well

    Roberto Gutierrez R.

     

     

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of COM Interoperability in .NET Part 2.

Leave a comment

Sign in or Join us (it's free).

G.Gnana Arun Ganesh G.Gnana Arun Ganesh is the Administrator and the Founder of ARUN MICRO SYSTEMS (www.arunmicrosystems.netfirms.com). He has been programming in C++, Visual Basic, COM, Java and Microsoft Technologie...

Related podcasts

  • More jQuery in ASP.NET

    In this episode Chris Brandsma, Rick Strahl, Dave Ward, Bertrand Le Roy, and Scott Koon conclude their discussion of Microsoft's jQuery in ASP.NET announcement1.This episode of the Alt.NET Podcast is brought to you by LLBLGen Pro, the most mature O/R mapper and code generator out there.Are ...

Events coming up

  • Mar 15

    DevWeek 2010

    London, United Kingdom

    DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.

Want to stay in touch with what's going on? Follow us on twitter!