ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: How do I access COM object's nondefault interface?
by Markus Willi other posts by this author
Aug 17 2002 9:00PM messages near this date
Re: How do I access COM object's nondefault interface? | Re: How do I access COM object's nondefault interface?
Josef Sachs wrote:
>  Can anyone tell me how to access a COM object's nondefault interface?

I had the same question and after searching the net and watching source 
(win32com/...) i come to this hack:

given:
   class x with default interface X
   class y with default interface Y
   class y implements the interface Z too
   class x has a member (m) wich return a object y through the interface Z

solution:
   # y has now the Z interface
   y = x.m
   # y has now the 677...5A9 interface - Y interface
   y = win32com.client.Dispatch(y, 'm', 
'{677B5E26-A514-11D6-8F69-0048545505A9}', UnicodeToString=0)


I don't know if this hack is usefull for you. But I don't like it, because:
- I need the tool makepy
- the second parameter could be anything, the eg. I found used the name 
of a member function from the class x?!?
- the third parameter should be a name of the form "library.class", 
instead the CLSID

If I use the tool makepy to generate python code for early binding, I 
can not belive why I have to type somthing like this
x = win32com.client.Dispatch("library.class")
instead
x = library.class.
But this is stuff for a new thread.

OK. my english experience are better than python ;) That mean I use 
python just four days now and its great. I hope someone has a better 
solution to change the interface.

Markus

-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Josef Sachs
Carl Waldbieser
Josef Sachs
Carl Waldbieser
Markus Willi
Josef Sachs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved