先设置treeview的属性OLEDropMode
TreeView1.OLEDropMode = ccOLEDropManual
然后再treeview的OLEDragDrop事件里遍历Data.Files可以得到文件名建个工程,加个treeview,再加入下面的代码
Option ExplicitPrivate Sub Form_Load()
TreeView1.OLEDropMode = ccOLEDropManualEnd SubPrivate Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim i As Long
For i = 1 To Data.Files.Count
Debug.Print Data.Files(i)
Next
End Sub