现找的,给你!<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls,ShlObj;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>const FileName:string='c:/netlog.txt';<br>var<br> DataHandle: THandle;<br> DataPointer: PDROPFILES;<br>begin<br> DataHandle := GlobalAlloc(GMEM_DDESHARE or GMEM_MOVEABLE,SizeOf(DROPFILES)+2+Length(FileName));<br> DataPointer := PDROPFILES(GlobalLock(DataHandle));<br> FillChar(DataPointer^,SizeOf(DROPFILES)+2+Length(FileName),0);<br><br> DataPointer.pFiles:=SizeOf(DROPFILES);<br> DataPointer.pt:=Point(0,0);<br> DataPointer.fNC:=False;<br> DataPointer.fWide:=False;<br> Move(FileName[1],Pointer(Integer(DataPointer)+SizeOf(DROPFILES))^,Length(FileName));<br> GlobalUnlock(DataHandle);<br> OpenClipboard(Form1.Handle);<br> EmptyClipboard;<br> SetClipboardData(CF_HDROP, DataHandle);<br> CloseClipboard;<br>end;<br><br>end.<br>