.NET Class mad available as COM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lou

    .NET Class mad available as COM

    I have created a .net .dll using the wizard to create a COM class.
    Every thing is fine. Here is what I don't understand.
    If I import the .tlb file into a VB6 project it all works. However why can't
    I
    import the actual .dll file?
    How do you import the .dll file into a C++ app?

    I take it the .dll is not a COM object but has a COM expposed class with it
    and thats why
    only the .tlb works.
    Am I correct?
    any insight here might go a long way.

    Thanks
    -Lou


  • Scott M.

    #2
    Re: .NET Class mad available as COM

    Yes, you are correct. When you register a .NET assembly for COM InterOp, a
    COM Callable Wrapper (CCW) class is created for your COM code to interact
    with. This wrapper, in turn, communicates with the actual .NET assembly.


    "Lou" <lou.garvin@com cast.netwrote in message
    news:eerD7%23PN HHA.448@TK2MSFT NGP04.phx.gbl.. .
    >I have created a .net .dll using the wizard to create a COM class.
    Every thing is fine. Here is what I don't understand.
    If I import the .tlb file into a VB6 project it all works. However why
    can't I
    import the actual .dll file?
    How do you import the .dll file into a C++ app?
    >
    I take it the .dll is not a COM object but has a COM expposed class with
    it and thats why
    only the .tlb works.
    Am I correct?
    any insight here might go a long way.
    >
    Thanks
    -Lou
    >

    Comment

    • Lou

      #3
      Re: .NET Class mad available as COM

      So that would be the .tlb?

      how does the dll get registered on a target system, not my development
      system?

      -Lou

      "Scott M." <NoSpam@NoSpam. comwrote in message
      news:ujDT%23uQN HHA.4172@TK2MSF TNGP04.phx.gbl. ..
      Yes, you are correct. When you register a .NET assembly for COM InterOp,
      a COM Callable Wrapper (CCW) class is created for your COM code to
      interact with. This wrapper, in turn, communicates with the actual .NET
      assembly.
      >
      >
      "Lou" <lou.garvin@com cast.netwrote in message
      news:eerD7%23PN HHA.448@TK2MSFT NGP04.phx.gbl.. .
      >>I have created a .net .dll using the wizard to create a COM class.
      >Every thing is fine. Here is what I don't understand.
      >If I import the .tlb file into a VB6 project it all works. However why
      >can't I
      >import the actual .dll file?
      >How do you import the .dll file into a C++ app?
      >>
      >I take it the .dll is not a COM object but has a COM expposed class with
      >it and thats why
      >only the .tlb works.
      >Am I correct?
      >any insight here might go a long way.
      >>
      >Thanks
      >-Lou
      >>
      >
      >

      Comment

      • Michel Posseth [MCP]

        #4
        Re: .NET Class mad available as COM

        Huh ???
        Yes, you are correct. When you register a .NET assembly for COM InterOp,
        a COM Callable Wrapper (CCW) class is created for your COM code to
        interact with. This wrapper, in turn, communicates with the actual .NET
        assembly.
        Is this new in a version of .net that i not own ?? ( i use VS.Net 2003 PRO
        and VS .Net 2005 team system )

        I just set a reference to my com capable dll and it just works . a tlb is a
        type library and existed already in the pre .Net com days
        and is used to code against when you do not want to install the hole
        application on the development system ,
        The Wrapper that you are talking about is created by .Net if you set a
        reference to a pre .Net Com capable class

        Steps i take

        i just create a com class , register it with regasm , and set a reference
        to it from VB6

        regards

        Michel


        "Scott M." <NoSpam@NoSpam. comschreef in bericht
        news:ujDT%23uQN HHA.4172@TK2MSF TNGP04.phx.gbl. ..
        Yes, you are correct. When you register a .NET assembly for COM InterOp,
        a COM Callable Wrapper (CCW) class is created for your COM code to
        interact with. This wrapper, in turn, communicates with the actual .NET
        assembly.
        >
        >
        "Lou" <lou.garvin@com cast.netwrote in message
        news:eerD7%23PN HHA.448@TK2MSFT NGP04.phx.gbl.. .
        >>I have created a .net .dll using the wizard to create a COM class.
        >Every thing is fine. Here is what I don't understand.
        >If I import the .tlb file into a VB6 project it all works. However why
        >can't I
        >import the actual .dll file?
        >How do you import the .dll file into a C++ app?
        >>
        >I take it the .dll is not a COM object but has a COM expposed class with
        >it and thats why
        >only the .tlb works.
        >Am I correct?
        >any insight here might go a long way.
        >>
        >Thanks
        >-Lou
        >>
        >
        >

        Comment

        • Mattias Sjögren

          #5
          Re: .NET Class mad available as COM

          >I have created a .net .dll using the wizard to create a COM class.
          >Every thing is fine. Here is what I don't understand.
          >If I import the .tlb file into a VB6 project it all works. However why can't
          >I import the actual .dll file?
          Because the DLL file doesn't contain a typelib resource. You can add
          that manually if you want, here's how

          How to: Embed Type Libraries as Win32 Resources in .NET-Based
          Applications


          >How do you import the .dll file into a C++ app?
          With an #import directive.


          Mattias

          --
          Mattias Sjögren [C# MVP] mattias @ mvps.org
          http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
          Please reply only to the newsgroup.

          Comment

          • Mattias Sjögren

            #6
            Re: .NET Class mad available as COM

            >Yes, you are correct. When you register a .NET assembly for COM InterOp, a
            >COM Callable Wrapper (CCW) class is created for your COM code to interact
            >with. This wrapper, in turn, communicates with the actual .NET assembly.
            No, a type library is created. Type libraries contain only metadata
            describing the COM types, no code at all. CCWs are objects created at
            runtime.


            Mattias

            --
            Mattias Sjögren [C# MVP] mattias @ mvps.org
            http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
            Please reply only to the newsgroup.

            Comment

            • =?Utf-8?B?TWljaGVsIFBvc3NldGggW01DUF0=?=

              #7
              Re: .NET Class mad available as COM

              Mattias ,,

              I can`t remember i ever did what is described at the link you provide


              i did it like this in the past




              And i could just directly set a refernce to it from VB6

              regards

              Michel

              "Mattias Sjögren" wrote:
              >
              I have created a .net .dll using the wizard to create a COM class.
              Every thing is fine. Here is what I don't understand.
              If I import the .tlb file into a VB6 project it all works. However why can't
              I import the actual .dll file?
              >
              Because the DLL file doesn't contain a typelib resource. You can add
              that manually if you want, here's how
              >
              How to: Embed Type Libraries as Win32 Resources in .NET-Based
              Applications

              >
              >
              How do you import the .dll file into a C++ app?
              >
              With an #import directive.
              >
              >
              Mattias
              >
              --
              Mattias Sjögren [C# MVP] mattias @ mvps.org
              http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
              Please reply only to the newsgroup.
              >

              Comment

              Working...