[API]
LocalAlloc
RtlMoveMemory
LocalFree

[INCLUDE]
PokeL
DragQueryFile
UIntAddUInt
PeekL

[CODE]
Public Function DropFilesCopy_Create(ByRef hDrop As Long, ByVal lParamKeyStates As Long) As Long
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xLong4 As Long
  Dim Shift As Long
  Dim xCharA1() As String
  
  Shift = (lParamKeyStates And 6) ' msshift 4 mkrbutton 2
  xLong1 = DragQueryFileCount(hDrop)
  If Not xLong1 = 0 Then
    ReDim xCharA1(xLong1 - 1&)
    For xLong1 = 0& To xLong1 - 1&
      If DragQueryFile(hDrop, xLong1, xCharA1(xLong4)) Then
        xLong2 = xLong2 + Len(xCharA1(xLong4))
        xLong4 = xLong4 + 1&
        End If
      Next
    DropFilesCopy_Create = LocalAlloc(0&, xLong2 * 2& + (xLong4 + 2&) * 4&) 'datacount, button
    If Not DropFilesCopy_Create = 0& Then
      xLong2 = DropFilesCopy_Create
      Call PokeL(xLong2, xLong4)
      UIntAddUInt xLong2, 4&
      Call PokeL(xLong2, CLng(Shift))
      UIntAddUInt xLong2, 4&
      For xLong1 = 0& To xLong4 - 1&
        xLong3 = Len(xCharA1(xLong1))
        Call PokeL(xLong2, xLong3)
        UIntAddUInt xLong2, 4&
        xLong3 = xLong3 * 2&
        Call RtlMoveMemory(ByVal xLong2, ByVal StrPtr(xCharA1(xLong1)), xLong3)
        Call UIntAddUInt(xLong2, xLong3)
        Next
      'Call PostMessage(xStaticIconsHWnd(xStaticIcons_ShowIR), &H400&, -1&, 1&)
      End If
    End If
  'DragFinish hDrop
  'hDrop = 0&
  End Function

Public Sub DropFilesCopy_Descard(ByRef hDropCopy As Long)
  Call LocalFree(hDropCopy)
  hDropCopy = 0&
  End Sub

Public Function DropFilesCopy_ReadOpen(ByVal hDropCopy As Long, ByRef NumFiles As Long, Optional ByRef KeyMods As Long) As Long
  DropFilesCopy_ReadOpen = hDropCopy
  NumFiles = PeekL(DropFilesCopy_ReadOpen)
  Call UIntAddUInt(DropFilesCopy_ReadOpen, 4&)
  KeyMods = PeekL(DropFilesCopy_ReadOpen)
  Call UIntAddUInt(DropFilesCopy_ReadOpen, 4&)
  End Function

Public Function DropFilesCopy_GetNextFile(ByRef hDropCopyMem As Long) As String
  Dim xLong1 As Long
  
  xLong1 = PeekL(hDropCopyMem)
  Call UIntAddUInt(hDropCopyMem, 4&)
  DropFilesCopy_GetNextFile = String(xLong1, vbNullChar)
  xLong1 = xLong1 * 2&
  Call RtlMoveMemory(ByVal StrPtr(DropFilesCopy_GetNextFile), ByVal hDropCopyMem, xLong1)
  Call UIntAddUInt(hDropCopyMem, xLong1)
  End Function
