[python-win32] Drag and drop of files (CF_HDROP)

mir amicitas amicitas at gmail.com
Sat Sep 20 20:36:57 CEST 2008


I have been trying to implement drag and drop of files in python.  My
application will written in PyQt4 but they I want to use the native drag and
drop for windows as PyQt only supports mime based dragging, which does not
work for some of the windows applications that I want to connect with.

I have made a certain amount of progress getting this to work using pywin32,
however I have gotten stuck.

So far I have been able to implement dragging of text (CF_TEXT or
CF_UNICODETEXT).  This basically took reimplementing the IDropSource &
IDataObject objects, wrapping them using win32com.server.util.wrap() and
then calling pythoncom.DoDragDrop().  For some of this I have been able to
follow allong with the code in testClipboard.py that is included with the
pywin32 installaiton.

The next thing that I want to do is to use CF_HDROP as the format type with
a list of file locations.  I am getting stuck at the point when I actually
add the list of file locations to the pythoncom.STGMEDIUM() object.

>From what I can gather this data needs to be placed into a DROPFILES
structure (msdn page on CF_HDROP &
DROPFILES<http://msdn.microsoft.com/en-us/library/bb776902%28VS.85%29.aspx>).
So my questing is how to I create this structure in pywin32?


Any help on this would be appretiated, particularly since I can't find
documentation for a lot of this stuff (I have resorted to greping the source
code to find stuff).  I am totaly new to win32 programming so this has been
a bit more that I meant to bite off.

If anyone knows of an easyer way to achive this I would be happy to hear of
it.


Thanks,
-- amicitas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080920/0a389c9f/attachment.htm>


More information about the python-win32 mailing list