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. COM
  4. QueryInterface( ..., void** ppv)

QueryInterface( ..., void** ppv)

Scheduled Pinned Locked Moved COM
question
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi, could anybody explain please the reason for QueryInterface's second parameter being a double pointer? Thanks PP

    B S 2 Replies Last reply
    0
    • L Lost User

      Hi, could anybody explain please the reason for QueryInterface's second parameter being a double pointer? Thanks PP

      B Offline
      B Offline
      Bill Wilson
      wrote on last edited by
      #2

      I believe it is so QueryInterface can return a pointer. Hope this helps, Bill

      1 Reply Last reply
      0
      • L Lost User

        Hi, could anybody explain please the reason for QueryInterface's second parameter being a double pointer? Thanks PP

        S Offline
        S Offline
        Shadi Al Kahwaji
        wrote on last edited by
        #3

        Hi, Let us start from the begining of the C/C++ language without COM. In the C/C++ language, whenever you have a class which contains at least ONE Virtual Function/Pure Function, a virtual table will be created at run time for this class which contains a list of the virtual functions in that class, and a Hidden pointer which called _vPtr is returned, this pointer points to the first entry in the virtual table. Let us back to the COM world, QueryInterface is a method in the IUnknown interface, and IUknown interface is accessing the functionality of the component through virtual table. The interface which returned from the QueryInterface is NOT poiting to the virtual table directly, it points to the hidden pointer _vPtr which points to the virtual table. For this reason we have pointer to pointer. ;) Regards, ShadiK. Shadi Al-Kahwaji

        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