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

Tim Golden mail at timgolden.me.uk
Sun Sep 21 11:25:57 CEST 2008


mir amicitas wrote:
> 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.


Can you have a look at this thread from earlier this
year to see if it helps to answer you question:

http://mail.python.org/pipermail/python-win32/2008-April/007409.html

TJG


More information about the python-win32 mailing list