[python-win32] Creating python com objects

Roger Upole rwupole at msn.com
Thu Apr 24 03:15:56 CEST 2008


Alex Denham wrote:
> Hi,

> Anybody happen to know how to go about creating a COM object that 
> RegisterDragDrop() will actually accept?
>
> print dropTarget
> <COMObject Python.PyIDropTarget>
>
> pythoncom.RegisterDragDrop(_id, dropTarget)
>
> Traceback (most recent call last):
>   File "C:\Python25\DragAndDrop.py", line 82, in <module>
>     main()
>   File "C:\Python25\DragAndDrop.py", line 41, in main
>     pythoncom.RegisterDragDrop(_id, dropTarget)
> ValueError: argument is not a COM object
>
> Any help appreciated,
>
> Thanks
> Alex

How was your dropTarget object created ?
Normally, you'd create a class that implements the
methods of IDropTarget and either register it or
wrap it for local use using pythoncom.WrapObject.

It does look like PyIDropTarget is lacking docs, I'll
try to improve them.  Also, the other interface you'll
probably need (PyIDataObject) needs some
attention in the docs.

        Roger




More information about the python-win32 mailing list