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

Reply via email to