I'm doing a project that has 2 ListViews and I wanna drag from one and drop to another. It has to be multiple select, and also using OLE ...
Gime some hint ... or example would be great ..
Thanks in advance
Printable View
I'm doing a project that has 2 ListViews and I wanna drag from one and drop to another. It has to be multiple select, and also using OLE ...
Gime some hint ... or example would be great ..
Thanks in advance
Other people will be able to help with the ListView elements, but here is some info on the OLE drag and drop - typically used when dragging things to and from Windows Explorer.
the OLEDropMode must be set to:
1 – Manual
for every object on the form that wants to receive a dropped file.
There are different OLExxxx subroutines that can be coded – the only one that is definitely required is the OLEDragDrop routine, which gets run when an item is dropped onto that object on the form.
The data that has been packaged by the dragged from application / object, is available to the dropped on application / object, although it must be decoded first.
To identify a list of files from Windows Explorer you can use the following:
The Format numbers used in the OLE DragDrop data structure, are:VB Code:
Dim i As Integer If Data.GetFormat(15) Then 'Format 15 is an array of names from WinExplorer Add.To.Your.List Data.Files(1) For i = 2 To Data.Files.Count Add.To.Your.List Data.Files(i) Next i Data.Files.Clear End If
Text = 1 (vbCFText)
Bitmap = 2 (vbCFBitmap)
Metafile = 3
Emetafile = 14
DIB = 8
Palette = 9
Files = 15 (vbCFFiles)
RTF = -16639
If you want to drop files from your application back to Windows Explorer, the following will load the correct data structure with the file names (full names plus path are needed). Remember: Dropping these filenames onto Windows Explorer will initiate a copy operation.
VB Code:
Data.Files.Add "C:\Temp\Myfile1.TXT", 1 Data.Files.Add "C:\Temp\Yourfile2.TXT", 2 Data.SetData , 15
Thanks alot
That wasn't exactly what I'm after. But still helpful.
BTW, I fixed that by when startDrag I copy the Item in to the temporary Item. Then when DragDrop i add the temporary Item into the destination listview.