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 Josef Sachs other posts by this author
Aug 16 2002 5:02PM messages near this date
Re: How do I access COM object's nondefault interface? | Re: Memory overhead for trees?
> >>>> On 15 Aug 2002 17:05:51 -0400, Josef Sachs said:

>  Can anyone tell me how to access a COM object's nondefault interface?

>  I saw the postings from mhurwitch@[...].com and
>  Toby Dickenson <htrd90@[...].org> on the subject in 1999,
>  and I tried the methodology suggested (below) but it just
>  crashes pythonwin.

>  I'd greatly appreciate any assistance.

>  By the way, is there a better place to ask Python-win32 questions?
>  I have hardly received any responses to my recent postings.

>  def qi(object,iid):
>   # Query for given iid, but use the IDispatch wrapper. The given iid
>   # must correspond to a dual interface or dispinterface
>   dispatch=object._oleobj_.QueryInterface(iid,pythoncom.IID_IDispatch)
>   # Create the best dispatch object we can, using makepy version if possible
>   return win32com.client.Dispatch(dispatch,resultCLSID=iid)

I have now also tried Mark Hammond's suggested methodology from an article
posted 2000/07/27 (Subject: Re: Two COM Questions: QueryInterface, and
Callback Inheritance), but it also crashes pythonwin.  Any suggestions?

> >> import win32com.client
> >> x=win32com.client.DispatchWithEvents("XMsg2.RoxBase.1", eventHandlerClass)
> >> a=x.GetMessage()
> >> a
<win32com.gen_py.xMsg2 CLIENT - Rox System Interface.IOrderAck> 
> >> import win32com.client.gencache
> >> m=win32com.client.gencache.GetModuleForCLSID('{E21C8E4F-9D58-4618-B4E5-D8F1B0EAF649}')
> >> m
<module 'win32com.gen_py.497668DA-5952-4028-AB0A-20E2E55C9490x0x1x0' from 'G:\Python22\Lib\s
ite-packages\win32com\gen_py\497668DA-5952-4028-AB0A-20E2E55C9490x0x1x0.pyc'> 
> >> b=m.IxMessage
> >> b
<class win32com.gen_py.497668DA-5952-4028-AB0A-20E2E55C9490x0x1x0.IxMessage at 0x0141DE80> 
> >> c=b(a)
> >> c
<win32com.gen_py.xMsg2 CLIENT - Rox System Interface.IxMessage> 
> >> c.SenderSeqNumber
[crash]
-- 
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