COM Question - QueryInterface?
Chris Tavares
tavares at connix.com
Mon Jun 7 22:17:58 EDT 1999
I've got a (hopefully easy) question about python's COM support.
I'm developing a COM object in C++ which implements the COM collection
idiom - an Item method that returns another object. The code in Python
I'm using is something like this:
from win32com.client import Dispatch
drives = Dispatch("AmAccess.Drives")
drive = drives.Item("c:")
dir = drive.Item("some-area")
On this last line, I get an AttributeError for Item.
I think I know the reason why - the interface returned from Drives.Item
isn't a dual, it's an oleautomation compatible vtable interface.
IDispatch on that object is implemented separately. So, PythonCOM sees
the VT_UNKNOWN return type and wraps a PYIUnknown object around it. I
need to be able to do a QueryInterface for IDispatch.
How do I get Python to do that? There's a PyIID type, but apparently it
only works for class or progids. Anyone got any suggestions?
Thanks for any help,
-Chris
More information about the Python-list
mailing list