Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Not able to get memory of Hierarchy in QT-COM
Qt 6.12 LTS is out! See what's new in the release blog

Not able to get memory of Hierarchy in QT-COM

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 417 Views
  • 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.
  • M Offline
    M Offline
    Madhura
    wrote on last edited by
    #1

    We have Base and 2 derived class, If we try to get the derived class memory in COM using Queryinterface we face a Error: "E_NOINTERFACE No such interface supported".

    Code snippet :

    Main.cpp

    QAXFACTORY_BEGIN((SWIQAX_FACTORY_BEGIN, SWIQAX_FACTORY_END)
    QAXCLASS(Base)
    QAXTYPE(D1)
    QAXTYPE(D2)
    QAXFACTORY_END()

    Class Base {}

    Class D1 : Base {}

    Class D2 : D1 {}

    In Client :

    CComPtr<Base> B1;
    CComPtr<D2> D1;
    CComPtr<D2> D2;
    HRESULT hr = B1->CoCreate(uuid(Base));

    HRESULT hr1 = B1.QueryInterface(&D2); -> Here We are able to get memory of D2

    HRESULT hr2 = B1.QueryInterface(&D1); -> Here we are not able to get the memory for D1 (NULL)
    HRESULT hr3 = D2.QueryInterface(&D1); -> Here also we are not able to get the memory for D1 (NULL)

    Is there any way we can get memory of D1 ? or any macro like QAXFACTORY_BEGIN will help us to get D1 memory

    1 Reply Last reply
    0
    • hskoglundH Online
      hskoglundH Online
      hskoglund
      wrote on last edited by
      #2

      In the client's code, try change from:

      ...
      CComPtr<D2> D1;
      CComPtr<D2> D2;
      ...
      

      to

      ...
      CComPtr<D1> D1;
      CComPtr<D2> D2;
      ...
      
      M 1 Reply Last reply
      0
      • hskoglundH hskoglund

        In the client's code, try change from:

        ...
        CComPtr<D2> D1;
        CComPtr<D2> D2;
        ...
        

        to

        ...
        CComPtr<D1> D1;
        CComPtr<D2> D2;
        ...
        
        M Offline
        M Offline
        Madhura
        wrote on last edited by
        #3

        @hskoglund

        Yes we have made syntax error on code which we have posted as you said we have tried on it but still we are facing same issue not able to get D1.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved