高分求一个拷贝目录的函数,大家看看,谁知道?(30分)

  • 主题发起人 主题发起人 hurryman
  • 开始时间 开始时间
H

hurryman

Unregistered / Unconfirmed
GUEST, unregistred user!
我想将一个C:/a 的目录整个拷贝到d:/b下,用什么函数?
 
30分可不是高分哦

procedure CopyDirctor(Ahandle:Thandle;const AfromDirector,AtoDirector:string);
var
ShFileOpStruct:TSHFileopStruct;
FromDir:Pchar;
Todir:Pchar;
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;
 

Similar threads

回复
0
查看
968
不得闲
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
890
SUNSTONE的Delphi笔记
S
后退
顶部