Seite 1 von 1

GetClipboardData_() #CF_HDROP

Verfasst: 01.10.2009 19:09
von Kai
Kann bestimmt der ein oder andere gebrauchen.
Liest aus der Zwischenablage die Kopierten Dateipfade aus.

Code: Alles auswählen

EnableExplicit

; Ermitelt die Anzahl an Dateipfade
Procedure.i Clipboard_GetFileCount()
  If OpenClipboard_(0)
    Protected iClipboard.i
    Protected iAmount.i
    
    iClipboard = GetClipboardData_(#CF_HDROP)
    If iClipboard
      iAmount = DragQueryFile_(iClipboard, $FFFFFFFF, 0, 0)
    EndIf
    
    CloseClipboard_()
    
    ProcedureReturn iAmount
  EndIf
EndProcedure

; Ergibt einen String der die Dateinamen getrennt mit | enthält
Procedure.s Clipboard_GetFileList()
  If OpenClipboard_(0)
    Protected hClipboard.i
    Protected Buffer.s = Space(#MAX_PATH)
    Protected Amount.i
    Protected i.i
    Protected sResult.s
    
    hClipboard = GetClipboardData_(#CF_HDROP)
    If hClipboard
      Amount = DragQueryFile_(hClipboard, $FFFFFFFF, 0, 0)
      
      For i = 0 To Amount - 1
        DragQueryFile_(hClipboard, i, @Buffer, #MAX_PATH)
        
        If Buffer
          sResult + Buffer
          If Amount - 1 > i
            sResult + "|"
          EndIf
        EndIf
      Next
      
    EndIf
    
    CloseClipboard_()
    
    ProcedureReturn sResult
  EndIf
EndProcedure

Re: GetClipboardData_() #CF_HDROP

Verfasst: 01.10.2009 21:17
von Hyper
Hallo Kai,
Du scheinst echt Ahnung von der Zwischenablage zu haben. Entschuldige, aber zu meiner aktuellen Fragestellung http://www.purebasic.fr/german/viewtopi ... =3&t=21004 hast Du nicht zufällig eine Idee? Das wäre nämlich super!