Thanks Tim, the program actually reacts when something is dragged over (much
better than before).
However i'm receiving an error everytime.
>>> pythoncom error: Unexpected exception in gateway method 'DragEnter'
<type 'exceptions.AttributeError'>: DragEnterpythoncom error: Unexpected
gateway error
Also, in the documentation it says:
Drop(pDataObj, pt, dwEffect)
Parameters
pDataObj : PyIDataObject *
How do i link the IDataObject to the IDragTarget?
Thanks
Alex
> Date: Thu, 24 Apr 2008 12:11:12 +0100> From: [EMAIL PROTECTED]> CC:
> python-win32@python.org> Subject: Re: [python-win32] Creating python com
> objects> > Alex Denham wrote:> > class PyIDropTarget:> > _public_methods_ =
> ['DragEnter', 'DragOver', 'DragLeave', 'Drop']> > _reg_progid_ =
> "Python.PyIDropTarget"> > _reg_clsid_ =
> '{00000122-0000-0000-C000-000000000046}'> > def DragEnter(self, args=None):>
> > print 'DragEnter: ', args> > def DragOver(self, args=None):> > print
> 'DragOver: ', args> > def DragLeave(self, args=None):> > print 'DragLeave: ',
> args> > def Drop(self, args=None):> > print 'Drop: ', args> > > > Then i just
> used the com register thing to register it, then i tried > > dropTarget =
> win32com.client.Dispatch("Python.PyIDropTarget")> > I didn't know about the
> pythoncomWrapObject however.> > You can't call Dispatch on this object
> because it's not> implementing IDispatch. I think you'll need something like>
> this (untested):> > <code>> import pythoncom> > CLSID =
> '{89DD545A-2C83-4103-AFE3-6CEB7FF5ECA4}'> # Generated by
> pythoncom.CreateGuid> PROGID = "Tim.DropTarget"> DESC = "Drop target handler
> for Tim's app"> > class DropTarget:> _reg_clsid_ = CLSID> _reg_progid_ =
> PROGID> _reg_desc_ = DESC> _public_methods_ = ['DragEnter', 'DragOver',
> 'DragLeave', 'Drop']> _com_interfaces_ = [pythoncom.IID_IDropTarget]> > def
> DragEnter(self, args=None):> print 'DragEnter: ', args> def DragOver(self,
> args=None):> print 'DragOver: ', args> def DragLeave(self, args=None):> print
> 'DragLeave: ', args> def Drop(self, args=None):> print 'Drop: ', args> >
> drop_target = pythoncom.WrapObject (> DropTarget, pythoncom.IID_IDropTarget>
> )> > #pythoncom.RegisterDragDrop (hWnd, drop_target)> > </code>>
> _______________________________________________> python-win32 mailing list>
> python-win32@python.org> http://mail.python.org/mailman/listinfo/python-win32
_________________________________________________________________
Search and win with BigSnapSearch.com
http://www.bigsnapsearch.com
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32