[python-win32] Re: Can we add 'native COM support' to a 3rd p arty DLL/OLB

Andrew MacIntyre Andrew.MacIntyre at aba.gov.au
Mon May 26 18:35:52 EDT 2003


> From: Thomas Heller
> Sent: Friday, 23 May 2003 6:45 PM

{...}

> I have not really followed the discussion, but ctypes has support
> for vtable based interfaces. I'm currently writing some docs, you may
> want to check it out:
> 
> http://starship.python.net/crew/theller/ctypes/
> http://starship.python.net/crew/theller/ctypes/com.html
> http://starship.python.net/crew/theller/ctypes/sum_sample.html

Well, this looks like it might be able to do what I want.

I've generated the module interface files with readtlb.py.  One of the 
libraries tripped readtlb.py by having references to VT_CARRAY (28) & 
VT_SAFEARRAY (27) which aren't (yet) supported in the TYPES dict.  I 
fudged TYPES dict entries and it looks like the references to these 
types are in parts of the object model I don't plan to go near, so I 
think that's no problem.

ArcGIS has a very extensive object hierarchy, and consequently most 
definitions are in a core object library, with the control libraries 
referring to interfaces & coclasses in the core object library. 
Consequently, I believe I have to manually modify the generated module 
interface files to import the right definitions in the right places.

Each generated interface file has a small number of definitions 
(classes COMObject, enum, dispinterface & DISPMETHOD + module variables 
OLECMDID & OLECMDEXCEPT).  With the need to import multiple modules, 
should these definitions be moved out of the interface files into 
a separately imported module?

While it would be nice to be able to use Pythonwin & ctypes together, 
as far as I can make out there's no way to get a useful IUnknown 
pointer (to feed to ctypes) from Pythonwin's PyIUnknown objects.

Just how to use ctypes for a control within another window, as distinct 
from the IE.Application example, eludes me at the moment...


-----------------------------------------------------------------------
Andrew MacIntyre                  \ E-mail: andrew.macintyre at aba.gov.au
Planning & Licensing Branch        \ Tel:   +61 2 6256 2812
Australian Broadcasting Authority   \ Fax:  +61 2 6253 3277
-> "These thoughts are mine alone!" <----------------------------------



More information about the Python-win32 mailing list