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 / C++ / MFC
  4. How to get a function from an ATL COM dll.

How to get a function from an ATL COM dll.

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++comtutorial
5 Posts 2 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.
  • H Offline
    H Offline
    HAHAHA_NEXT
    wrote on last edited by
    #1

    I have an ATL com dll and i want to get a function from it. The question is what is the syntax. Lets say the name of my dll is: Test and the name of my function is getName ?.

    A 1 Reply Last reply
    0
    • H HAHAHA_NEXT

      I have an ATL com dll and i want to get a function from it. The question is what is the syntax. Lets say the name of my dll is: Test and the name of my function is getName ?.

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      The syntax... the syntax of what? The syntax of the function? Do you mean the function prototype, do you need to know the function's prototype? Or perhaps you want to know how to go about calling that function. Please clarify. Regards, Alvaro


      Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.

      H 1 Reply Last reply
      0
      • A Alvaro Mendez

        The syntax... the syntax of what? The syntax of the function? Do you mean the function prototype, do you need to know the function's prototype? Or perhaps you want to know how to go about calling that function. Please clarify. Regards, Alvaro


        Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.

        H Offline
        H Offline
        HAHAHA_NEXT
        wrote on last edited by
        #3

        I want to know how to call the function.

        A 1 Reply Last reply
        0
        • H HAHAHA_NEXT

          I want to know how to call the function.

          A Offline
          A Offline
          Alvaro Mendez
          wrote on last edited by
          #4

          You'd do it the same way you call any COM method. First you need to get a hold of the COM object, and then you can call its method. There are several alternatives: - Import the DLL's type library into your project. Look at the #import directive. - Use the Class Wizard to add a class wrapper for the COM object. Open Class Wizard/Add Class/From a type library. - Use one of the template classes like CComQIPtr (ATL), or com_ptr_t. - Use the CoCreateInstance API. If my memory serves me right the first option is the easiest -- look into it. Good luck! Regards, Alvaro


          Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.

          H 1 Reply Last reply
          0
          • A Alvaro Mendez

            You'd do it the same way you call any COM method. First you need to get a hold of the COM object, and then you can call its method. There are several alternatives: - Import the DLL's type library into your project. Look at the #import directive. - Use the Class Wizard to add a class wrapper for the COM object. Open Class Wizard/Add Class/From a type library. - Use one of the template classes like CComQIPtr (ATL), or com_ptr_t. - Use the CoCreateInstance API. If my memory serves me right the first option is the easiest -- look into it. Good luck! Regards, Alvaro


            Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.

            H Offline
            H Offline
            HAHAHA_NEXT
            wrote on last edited by
            #5

            thx.

            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