type
PDropFiles = ^TDropFiles;
TDropFiles = record
pFiles: DWORD; { offset of file list }
pt: TPoint; { drop point (client coords) }
fNC: BOOL; { is it on NonClient area }{ and pt is in screen coords }
fWide: BOOL; { WIDE character switch }
end;
HandleDropEffect := RegisterClipboardFormat('Preferred DropEffect');
hGblDropEffect := GlobalAlloc(GMEM_ZEROINIT or GMEM_MOVEABLE or GMEM_SHARE, sizeof(DWORD));
pdwDropEffect := GlobalLock(hGblDropEffect);
if(bCopy) then
pdwDropEffect^ := DROPEFFECT_COPY
else
pdwDropEffect^ := DROPEFFECT_MOVE;
GlobalUnlock(hGblDropEffect);
if OpenClipboard(0) then
begin
EmptyClipboard();
SetClipboardData(HandleDropEffect,hGblDropEffect);
SetClipboardData( CF_HDROP, hGblFileList );
CloseClipboard();
end
else
showmessage('无法打开,可能被别的程序占用');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
CutOrCopyFiles('c:\test\1.txt'+#0+'c:\test\2.txt'+#0,28,false);
end;