Announcement

Collapse
No announcement yet.

Get iEnumerator from nodelist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edwin Knoppert
    replied
    I'll make this the 2nd option then.
    Thanks,

    Leave a comment:


  • José Roca
    replied
    Could this mean i don't need the Invoke(-4) stuff for any late bound Dispatch interface?
    Calling the _NewEnum method (dispID -4) is the safer way, and the only that will work if you write a component to be used by languages such VB that use the FOR EACH construct.

    Leave a comment:


  • José Roca
    replied
    The classic way is to add the _NewEnum method/property to your collection class and, in that method, return a pointer to your implementation of the IEnumVARIANT class. Calling QueryInterface for IEnumVARIANT won't work if the enumerator isn't implemented in the same class.

    Leave a comment:


  • Edwin Knoppert
    replied
    is it possible to implement this enumerator interface into PB classes?
    Maybe simply adding it icw it's guid?
    I don't have much influence on the QueryInterface is it?

    Leave a comment:


  • Edwin Knoppert
    replied
    Oh btw, i used call dword with vtable offsets, forgot to memtion.
    I just rewrote it.

    Leave a comment:


  • Edwin Knoppert
    replied
    That is a compiler issue and solvable.
    For me it's more important i can use this on any interface (unknown/dispatch) which supports the enumeration.

    And -4 is a 'fixed' member also and i could use this but i like this better.

    I also believe this will help me with non-dual interfaces.

    Leave a comment:


  • José Roca
    replied
    But be aware that these built-in methods are undocumented...

    Leave a comment:


  • Edwin Knoppert
    replied
    Cool!

    Much better than the invoke..

    Leave a comment:


  • José Roca
    replied
    For some reason, the built-in QueryInterface method does not work if you pass a constant. Use a variable as I did in my previous post:

    Code:
            Local pUnk As Dword Ptr
            Local IID_IEnumVARIANT As GUID
            IID_IEnumVARIANT = $IID_IEnumVARIANT
            If oDisp.QueryInterface(IID_IEnumVARIANT, ByVal VarPtr(pUnk)) = 0 Then
            End If

    Leave a comment:


  • Edwin Knoppert
    replied
    This works:
    Code:
            If oDisp.Invoke( -4, IID_NULL, 0, 1 Or 2, udispparams, vResult, ByVal VarPtr( pExcepInfo ), puArgErr ) = 0 Then
                oEnum = vResult: vResult = Empty
            End If
    This not:
    Code:
            Local pUnk As Dword Ptr
            If oDisp.QueryInterface($IID_IEnumVARIANT, ByVal VarPtr(pUnk)) = 0 Then
            End If
    pUnk remains 0

    Leave a comment:


  • Edwin Knoppert
    replied
    Oops, though that wasn't possible.
    When i took a closer look i was thinking you did this on the resulting interface.

    Could this mean i don't need the Invoke(-4) stuff for any late bound Dispatch interface?

    Leave a comment:


  • José Roca
    replied
    Use:

    Code:
    LOCAL hr AS LONG
    LOCAL pEnum AS IEnumVARIANT
    LOCAL IID_IEnumVARIANT AS GUID
    IID_IEnumVARIANT = $IID_IEnumVARIANT
    hr = oNodeList.QueryInterface(IID_IEnumVARIANT, BYVAL VARPTR(pEnum))

    Leave a comment:


  • Edwin Knoppert
    replied
    I just found out that i misinterpret someone's code.
    This subject can be deleted, it's going nowhere.

    Leave a comment:


  • Michael Mattias
    replied
    Maybe pEnum needs to be defined as a PTR variable type?

    As written, the compiler would pass a ptr to a DWORD, not a ptr to a ptr as required for iUnknown.queryInterface

    Leave a comment:


  • Edwin Knoppert
    started a topic Get iEnumerator from nodelist

    Get iEnumerator from nodelist

    I am trying to get me the nodes via the enumerator.
    problem is that the nodelist object is a late bound object.
    So i was trying to use the interface pointer -4 to call the enumvariant interface.
    Frankly i find the hard offsets a poor design.
    Any luck i can keep using the late bound object and fetch me the enumerator anyway?
    The enumerator is declared (early binding)

    I seen code using Queryinterface but does not return an object:
    Code:
        Local oUnk  As IUnknown    
        Local pEnum As Dword
        oUnk = oNodeList    
        oUnk.QueryInterface( $IID_IEnumVARIANT, pEnum ) To hr
Working...
X