uses ShellAPI;
procedure CopyFile(Handle:THandle;Source, Dest : string);
var
OpStruc: TSHFileOpStruct;
frombuf, tobuf: Array [0..128] of Char;
Begin
fillChar(OpStruc, Sizeof(OpStruc), 0);
FillChar(frombuf, Sizeof(frombuf), 0);
FillChar(tobuf, Sizeof(tobuf), 0);
StrPCopy(frombuf, Source);
StrPCopy(tobuf, Dest);
With OpStruc DO Begin
Wnd:= Handle;
wFunc:= FO_COPY; //or FO_MOVE or FO_DELETE
pFrom:= @frombuf;
pTo:=@tobuf;
fFlags:= FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:= False;
hNameMappings:= Nil;
lpszProgressTitle:= Nil;
end;
ShFileOperation( OpStruc );
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
CopyFile(self.Handle, 'C:/A/*.*','C:/B/');
end;