1. How can extract one item in OLEStartDrag event?
In various ways. You should fill the "Data" parameter during the ListView_OLEStartDrag event. You can store the name of object or other locate information where the Picture control could load the image from. You can also store the image of the ListView's item in Screen.MouseIcon (as you can see from description of the OLEGiveFeedback event). E.g.
Code:
Private Sub ListView1_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
Effect = (vbDropEffectMove Or vbDropEffectCopy)
Screen.MousePointer = vbCustom
Set Screen.MouseIcon = ListView1.Icons.ListImages(ListView1.SelectedItem.Icon).Picture
DefaultCursors = False
End Sub
... And so on.
2. I would pass the file name to the target, then what format should I use? vbCFText? or vbCFFiles? or other format?
There are some methods to do this in ListView1_OLEStartDrag event.
a) Filling real data
Code:
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
AllowedEffects = (vbDropEffectMove Or vbDropEffectCopy)
'
Call Data.SetData("some_file", vbCFText)
Call Data.SetData(, vbCFFiles)
Call Data.Files.Add("some_file") ' ...
End Sub
b) Filling only the supported formats value and fill real data only in ListView1_OLESetData with required format.
Code:
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
AllowedEffects = (vbDropEffectMove Or vbDropEffectCopy)
'
Call Data.Clear
Call Data.SetData(, vbCFFiles)
Call Data.SetData(, vbCFText) ' ...
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
If DataFormat = vbCFFiles Then
Call Data.Files.Add("some_file") ' ...
ElseIf DataFormat = vbCFText Then
Call Data.SetData("some_file", DataFormat)
End If
End Sub
HTH