给你一个函数<br><br>uses <br> ShlObj, ClipBrd;<br><br>procedure CopyFilesToClipboard(FileList: string);<br>var<br> DropFiles: PDropFiles;<br> hGlobal: THandle;<br> iLen: Integer;<br>begin<br> iLen := Length(FileList) + 2;<br> FileList := FileList + #0#0;<br> hGlobal := GlobalAlloc(GMEM_SHARE or GMEM_MOVEABLE or GMEM_ZEROINIT,<br> SizeOf(TDropFiles) + iLen);<br> if (hGlobal = 0) then raise Exception.Create('Could not allocate memory.');<br> else begin<br> DropFiles := GlobalLock(hGlobal);<br> DropFiles^.pFiles := SizeOf(TDropFiles);<br> Move(FileList[1], (PChar(DropFiles) + SizeOf(TDropFiles))^, iLen);<br> GlobalUnlock(hGlobal);<br> Clipboard.SetAsHandle(CF_HDROP, hGlobal);<br> end;<br>end;<br>例子:<br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> CopyFilesToClipboard('C:.Txt'#0'C:.Bat');{Separate the files with a #0.}<br>end;<br><br><br><br>