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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. QueryInterface

QueryInterface

Scheduled Pinned Locked Moved ATL / WTL / STL
question
2 Posts 2 Posters 9 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.
  • Q Offline
    Q Offline
    qur
    wrote on last edited by
    #1

    Hi Is QueryInterface call AddRef() ? STDMETHODIMP CPatternGenerator::GetLayout(long lIndex, ILayout ** pVal) { // TODO: Add your implementation code here if (lIndex >=0 && lIndex < m_vLayoutList.size()){ m_vLayoutList[lIndex]->QueryInterface(IID_ILayout, (void**) pVal); m_vLayoutList[lIndex]->AddRef(); // Is this statement required. return S_OK; } return E_INVALIDARG; } My understanding is that QueryInterface has already called AddRef so we dont need it. Am i correct? Thanks Qur

    T 1 Reply Last reply
    0
    • Q qur

      Hi Is QueryInterface call AddRef() ? STDMETHODIMP CPatternGenerator::GetLayout(long lIndex, ILayout ** pVal) { // TODO: Add your implementation code here if (lIndex >=0 && lIndex < m_vLayoutList.size()){ m_vLayoutList[lIndex]->QueryInterface(IID_ILayout, (void**) pVal); m_vLayoutList[lIndex]->AddRef(); // Is this statement required. return S_OK; } return E_INVALIDARG; } My understanding is that QueryInterface has already called AddRef so we dont need it. Am i correct? Thanks Qur

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      Yes, the returned interface has incremented the reference count prior to being returned to you. Tim Smith I'm going to patent thought. I have yet to see any prior art.

      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