Ed Blake schrieb:
> --- Thomas Heller <[EMAIL PROTECTED]> wrote:
> 
>> Ed Blake schrieb:
>> > Yay, more problems!  Today i need to set a property of a specific object,
>> > unfortunately I can't get the object because instead I am given a pointer
>> to
>> > a bound method.  I've poked around as much as I could, but I can't figure
>> > this one out either.
>> > 
>> > The object is accessed thus:
>> > Application.ActiveSettings.TextStyle
>> > Application.ActiveSettings returns a pointer to an _Settings object
>> > Here is the _Settings._methods_ entry for the property I want to access:
>> > COMMETHOD([dispid(1610743823), 'propget'], HRESULT, 'TextStyle',
>> >           ( ['retval', 'out'], POINTER(POINTER(_TextStyle)), 'pVal' )),
>> > 
>> > Here is the output and the error thrown:
>> > <bound method POINTER(_Settings).TextStyle of <POINTER(_Settings) object
>> > 2e2ec60>>
>> > Traceback (most recent call last):
>> >   File "G:\files\scripts\table.py", line 109, in <module>
>> >     build_table(app, excel)
>> >   File "G:\files\scripts\table.py", line 58, in build_table
>> >     old_just = style.Justification
>> > AttributeError: 'WinFunctionType' object has no attribute 'Justification'
>> > 
>> > I'm trying to retrieve the object, but the property can also be set to a 
>> > new
>> > object if that matters.
>> 

If you get a 'WinFunctionType' instead of the property you expect, have you
tried to call that function and inspect what it returns?  Maybe
your 'property' is a method, instead?

I know that some COM objects properties expect to be called, this is probably
because there is no real difference in visual basic between attributes and 
functions.

'WinFunctionType' is the type of automatically created COM methods.

And if you want to dive into the comtypes code:  The code that parses
the interface _methods_ lists and creates Python methods and properties from
them is in comtypes\__init__.py, in the functions 
'_cominterface_meta._make_methods'
(for custom interfaces), and '_cominterface_meta._make_dispmethods' (for 
dispinterfaces).

Thomas


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to