Tim Golden wrote:
Alex Denham wrote:
Parameters
/pDataObj/ : *PyIDataObject **
How do i link the IDataObject to the IDragTarget?
I don't know that you can, if you're asking: how do I
find out where this is coming from?. I think the drag-drop
technique is endpoint-agnostic. (A high-sounding phrase I've
just invented).
Don't forget to trademark it !
The most you can do is get hold of the data.
Again, I think.
This is correct, the IDataObject interface is provided by the object
that's being dragged. Unless you're also providing the dragged
object the interface should be opaque.
I'm out of my depth so I'm hoping that Roger or Mark
or other more knowledgeable people can chip in at this point
and help.
For the purposes of discussion, I attach below my test harness
code which creates a simple window and registers a simple
IDropTarget object against it.
Sorry to be no more help than this.
TJG
<code>
import os, sys
import win32gui
import win32con
import pythoncom
CLSID = '{89DD545A-2C83-4103-AFE3-6CEB7FF5ECA4}'
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, data_object, key_state, point, effect):
pass
def DragOver (self, key_state, point, effect):
pass
def DragLeave (self):
pass
def Drop (self, data_object, key_state, point, effect):
pass
def create_window ():
def OnDestroy (hwnd, msg, wparam, lparam):
win32gui.PostQuitMessage (0)
wc = win32gui.WNDCLASS ()
hinst = win32gui.GetModuleHandle(None)
wc.lpszClassName = "DragDrop"
wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
wc.hCursor = win32gui.LoadCursor (0, win32con.IDC_ARROW)
wc.hbrBackground = win32con.COLOR_WINDOW
wc.lpfnWndProc = {win32con.WM_DESTROY : OnDestroy}
classAtom = win32gui.RegisterClass (wc)
style = win32con.WS_VISIBLE | \
win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
return win32gui.CreateWindow (
classAtom,
"Drag & Drop demo",
style,
0, 0, 100, 100,
0, 0, hinst, None
)
if __name__ == '__main__':
pythoncom.OleInitialize ()
drop_target = pythoncom.WrapObject (
DropTarget,
pythoncom.IID_IDropTarget,
pythoncom.IID_IDropTarget
)
pythoncom.RegisterDragDrop (create_window (), drop_target)
win32gui.PumpMessages ()
</code>
There's a little extra work you have to do for WrapObject to work locally.
See \win32comext\authorization\demos\EditSecurity.py for an example.
Roger
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32