Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, _ Button As Integer, Shift As Integer, _ X As Single, Y As Single) Dim MyDataObject as IDataObject ' Get an uncounted reference to the IDataObject MoveMemory MyDataObject, ByVal ObjPtr(Data) + 16, 4 ' Use the IDataObject interface ' Release the IDataObject ' You can't use Set = Nothing because ' the reference is not counted MoveMemory MyDataObject, 0&, 4 End Sub
The DataObject class in Common Controls implements the IDataObject interface. To get it just asign the object to the IDataObject variable:
Private Sub ListView1_OLEDragDrop(Data As ComctlLib.DataObject, _ Effect As Long, _ Button As Integer, Shift As Integer, _ x As Single, y As Single) Dim MyDataObject As IDataObject Set MyDataObject = Data End Sub