//取复制到粘贴板文件名称列表到StrList中procedure GetClipFileNames(StrList : TStrings);var hDrop : UInt; FileName : array [0..MAX_PATH] of AnsiChar; i , nCount : integer;begin StrList.Clear; if not OpenClipboard(0) then exit; hDrop := GetClipboardData(CF_HDROP); if hDrop=0 then exit; nCount := DragQueryFile(hDrop , DWORD(-1) , NIL , 0); for i:=0 to nCount-1 do begin DragQueryFile(hDrop , i , @FileName , MAX_PATH); StrList.Add(FileName); end; CloseClipboard();end;procedure TForm1.Button1Click(Sender: TObject);var SL : TStringList; i : integer;begin SL := TStringList.Create; GetClipFileNames(SL); for i:=0 to SL.Count-1 do begin ShowMessage(SL.Strings[i]); end; SL.Free;end;
联系客服