Michael Curran schrieb:
> 
> In regards to use cases, I guess the reason why I want this 
> functionality is for the main project I am working on, which is the NVDA 
> screen reader, at
> http://www.nvda-project.org/
> 
> In that project we use comtypes very heavily, for MSAA, SAPI, RichEdit 
> controls, etc. But for our support for MS Word and Excel etc, we 
> currently use pywin32. Reason being that with comtypes the COM 
> interfaces are just way too large and take way too long to generate.
> 
> Pywin32 does a great job with dynamic dispatch, though its just annoying 
> having to use two Python COM implementations in the same project.
> 
> So this is why I would like to improve comtypes dynamic dispatch support.
> 
> I have also updated the patch, again, now fixing a few little issues 
> with the non-typeinfo dynamic dispatch support, and more importantly, I 
> have added some more tests to test_dyndispatch.py which tests many of my 
> code changes using MSAA objects.

Michael,

thanks for the patch and sorry for the late reply.  I have now made up my mind
and have a plan how I want to integrate this into comtypes.

1. I will add new named parameter to the object creation functions in 
comtypes.client,
CreateObject, GetActiveObject, and CoGetObject.  This parameter will be named
'dynamic' and will default to False.  If one of these functions is called with
'dynamic = True', then a dynamic dispatch object will be returned (an instance
of comtypes.client.dynamic._Dispatch).  No wrapper code will be generated, and
even if wrapper code is already there it will not be used.

2. It must be made sure that such an object will not trigger the code generation
when an attribute is accessed or a method is called.  Since all attribute and
method access goes through the 'IDispatch.Invoke' implementation in 
comtypes.automation,
the last line in this method (which now is '   return result.value') this is 
the place
where it can be implemented.  'result' is a VARIANT instance, and I will add a 
new
property - maybe result.dyn_value - that will return a dynamic dispatch object.

3. There are some good ideas in your patch for comtypes.client.dynamic - thanks 
for that.
But it seems there are still also a few problems with it which need to be fixed.

I will release the current code ASAP as comtypes-0.5.1 before starting with 
these changes,
hopefully it is not too late for you.

-- 
Thanks,
Thomas

-------------------------------------------------------------------------
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