Hi,

After testing with the dyndispatch svn branch of comtypes, I relised 
that there is a problem with dynamic Dispatch and IEnumVARIANT being 
used together.

The problem is that If you enumerate a dynamic dispatch object (you get 
an IEnumVARIANT object some how from it), that IEnumVARIANT object 
doesn't know it has to provide dynamic=True to variant._get_value. So, 
the IEnumVARIANT's next method returns objects with fully generated 
interfaces, rather than just dynamic dispatch support.

I would suggest that comtypes.automation.IEnumVARIANT have an instance 
variable called dynamic, which can be set to False by default. But if 
true, then the Next method should provide dynamic=True when getting 
variants.

The reason why I wouldn't suggest that dynamic just be a keyword 
argument on Next is that there are many different ways in using 
iterators in Python, not just by calling Next manually. Most situations 
use a For loop, therefore not allowing the use of a keyword argument. 
Example:
for x in IEnumVARIANTObj:

I took a look at the Next method in comtypes.automation.IEnumVARIANT. I 
see that when celt is 1, it calls _Next, but if its not it calls 
_com_Next. I assume that _Next automatically gets its out params 
converted and returned, and the _com_Next method is more literal?

If that is the case, then _Next wouldn't be able to be used at all as I 
guess the variant would be converted before we got a chance to do 
_get_value with dynamic=True.

Also, I notice at the bottom of Next it returns a list made from the 
variants in the array, converted to their real values using some ctypes 
out param method... should this instead be _get_value? or is that ctypes 
method very different?

If it was _get_value, then we would be able to pass the correct value 
for dynamic.

Does all this sound ok?

I'm hoping that as far as dynamic dispatch goes, IEnumVARIANT is the 
only other interface (other than IDispatch itself) that is used. If 
there are more, then perhaps adding dynamic=True to things everywhere 
isn't a good way to go.

Mick



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to