Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to use a com dll without embedded typelibrary in it?

How to use a com dll without embedded typelibrary in it?

Scheduled Pinned Locked Moved C#
c++comcsharphardwaretutorial
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kcynic
    wrote on last edited by
    #1

    There is a com dll written by C++ ATL. There is no embedded type library resource in it, although I have its type library(.tlb file) seperately. I can't add it to my C# project references. So, how should i do to use it?

    L 1 Reply Last reply
    0
    • K kcynic

      There is a com dll written by C++ ATL. There is no embedded type library resource in it, although I have its type library(.tlb file) seperately. I can't add it to my C# project references. So, how should i do to use it?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      use PInvoke to call C++ DLL. http://www.pinvoke.net/[^]

      K 1 Reply Last reply
      0
      • L Lost User

        use PInvoke to call C++ DLL. http://www.pinvoke.net/[^]

        K Offline
        K Offline
        kcynic
        wrote on last edited by
        #3

        Thanks for your reply. As we know, an atl com dll only export five functions: DllCanUnloadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer. So, im afraid that couldn't help to reach my aim, right?

        C L 2 Replies Last reply
        0
        • K kcynic

          Thanks for your reply. As we know, an atl com dll only export five functions: DllCanUnloadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer. So, im afraid that couldn't help to reach my aim, right?

          C Offline
          C Offline
          Covean
          wrote on last edited by
          #4

          Because it exports the function DllRegisterServer I would assume, that this COM dll isn't
          registered. Just use the regsrv32.exe to register it.

          Example:
              regsvr32.exe [Path]example.dll

          After you registered it, it should be visible in the COM tab of the "add reference" wizard.

          Greetings Covean

          K 1 Reply Last reply
          0
          • C Covean

            Because it exports the function DllRegisterServer I would assume, that this COM dll isn't
            registered. Just use the regsrv32.exe to register it.

            Example:
                regsvr32.exe [Path]example.dll

            After you registered it, it should be visible in the COM tab of the "add reference" wizard.

            Greetings Covean

            K Offline
            K Offline
            kcynic
            wrote on last edited by
            #5

            Oh, of course the com dll has been registered successfully. When add its reference by vs(it can be listed in the com tab list), vs will give me an error messagebox says "A reference to '*** Type Library' couldn't be added. This is not a COM component". But, if the dll has embedded type library in it, it will be ok.

            C 1 Reply Last reply
            0
            • K kcynic

              Oh, of course the com dll has been registered successfully. When add its reference by vs(it can be listed in the com tab list), vs will give me an error messagebox says "A reference to '*** Type Library' couldn't be added. This is not a COM component". But, if the dll has embedded type library in it, it will be ok.

              C Offline
              C Offline
              Covean
              wrote on last edited by
              #6

              Sorry but I never ran in this problem, so I never had to find a solution for this.

              Greetings Covean

              K 1 Reply Last reply
              0
              • K kcynic

                Thanks for your reply. As we know, an atl com dll only export five functions: DllCanUnloadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer. So, im afraid that couldn't help to reach my aim, right?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Then rewrite the code to C#. Or create a new library in C++.NET, call your C++ATL. Then use this lib in C#.

                K 1 Reply Last reply
                0
                • C Covean

                  Sorry but I never ran in this problem, so I never had to find a solution for this.

                  Greetings Covean

                  K Offline
                  K Offline
                  kcynic
                  wrote on last edited by
                  #8

                  Oh, thanks all the same. I will be glad to tell you the solution if i got it.

                  1 Reply Last reply
                  0
                  • L Lost User

                    Then rewrite the code to C#. Or create a new library in C++.NET, call your C++ATL. Then use this lib in C#.

                    K Offline
                    K Offline
                    kcynic
                    wrote on last edited by
                    #9

                    My be. But my main problem is create the component class. You know, in C#, i just reference the com dll. If i have to use the raw com dll file as common unmanaged dll, im not sure how to create the object and how to translate parameters. So, I hope to add referenct it via its type library(.tlb file).

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups