|
-
May 15th, 2002, 11:41 AM
#1
Thread Starter
New Member
Drag&Drop Between 2 ListViews Using OLE
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
-
May 16th, 2002, 04:53 AM
#2
Frenzied Member
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:
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
The Format numbers used in the OLE DragDrop data structure, are:
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
-
May 23rd, 2002, 12:27 PM
#3
Thread Starter
New Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|