30分可不是高分哦
procedure CopyDirctor(Ahandle:Thandle;const AfromDirector,AtoDirector:string);
var
ShFileOpStruct:TSHFileopStruct;
FromDir
char;
Todir
char;
begin
GetMem(FromDir,Length(AfromDirector)+2);
Try
GetMem(Todir,length(AtoDirector)+2);
try
FillChar(FromDir^,Length(AfromDirector)+2,0);
FillChar(ToDir^,Length(AToDirector)+2,0);
strcopy(FromDir,pchar(AfromDirector));
Strcopy(Todir,pchar(AtoDirector));
with ShFileOpStruct do
begin
wnd:=Ahandle;
wfunc:=Fo_COPY;
pfrom:=FromDir;
pto:=ToDir;
fFlags:=FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION or FOF_SILENT;
FanyoperationsAborted:=false;
hNameMappings:=nil;
LpszProgressTitle:=nil;
if shfileOperation(SHFileOpStruct)<>0 then
RaiseLastWin32Error;
end;
finally
Freemem(todir,Length(AToDirector)+2);
end;
finally
Freemem(fromdir,length(AFromDirector)+2);
end;
end;