I have a Visual Basic 6.0 application that I'm writing which loads up file information into a ListView control (which is part of the "Microsoft Windows Common Controls 6.0" [MSCOMCTL.OCX] ActiveX control library). I've got drag & drop functionality working for draging files *FROM* Windows Explorer to the ListView control. All I did was set the "OLEDragMode" property to "1 - ccOLEDragAutomatic", and set the "OLEDropMode" property to "1 - ccOLEDropManual"... and then I just capture the information passed into the "OLEDragDrop" event of the ListView via the "Data" parameter and populate the ListView with the file's information.
My problem is that I want to also write functionality so that I can drag & drop one or more files from the ListView *TO* Windows Explorer. So I have to find some way for the ListView to tell me what I'm dragging, when the drag operation is complete, and what the path is for the Windows Explorer window that the item was dragged to.
I've been playing around the the OLE events and I'm able to get the name of the item being dragged to Windows Explorer via the "Data" parameter of the "OLEDragOver" event... and I'm able to tell when the drag operation is complete via the "OLECompleteDrag" event... but I can't figure out how to get the path of the Windows Explorer window that the item was dragged to.
A thought that came to me was to get the handle of the window that's under the cursor using Win32 API's like "GetCursorPos" & "WindowFromPoint" once the "OLECompleteDrag" event fires... but having just a handle to a window where the item was dropped doesn't really help. I need to know the path of where it was dropped.
For Example: If the item was dragged to the Desktop, I need the path "C:\Documents and Settings\USER_NAME\Desktop
\" to be returned.
Any thoughts?
Thank you for your help with this!
Start Free Trial