花
花牛007
Unregistered / Unconfirmed
GUEST, unregistred user!
我编的以下程序,在运行第二个FileOp发生错误,我百思不解,请指教。
procedure Test;
begin
FileOp(handle,'d:/mydir1','d:/aaa','MOVE');
FileOp(handle,'d:/aaa/mydir1','d:/aaa','MOVE');
end;
procedure FileOp(hWndOwner: HWND; const SourceFile, TargetFile,strOp: string);
var sfosFile: TSHFileOpStruct;
begin
with sfosFile do
begin
Wnd := hWndOwner;
if strOP='COPY' then
wFunc := FO_COPY
else if strOP='MOVE' then
wFunc:=FO_MOVE
else if strOP='DELETE' then
wFunc:=FO_DELETE
else if strOP='RENAME' then
wFunc:=FO_RENAME
else
exit;
pFrom := pChar(SourceFile);
if strOP<>'DELETE' then
pTo := pChar(TargetFile)
else
pTo := #0#0;
fFlags := 0;
fAnyOperationsAborted := false;
end;
try
SHFileOperation(Info);
finally
showmessage(strOP+'错误!');
end;
end;
procedure Test;
begin
FileOp(handle,'d:/mydir1','d:/aaa','MOVE');
FileOp(handle,'d:/aaa/mydir1','d:/aaa','MOVE');
end;
procedure FileOp(hWndOwner: HWND; const SourceFile, TargetFile,strOp: string);
var sfosFile: TSHFileOpStruct;
begin
with sfosFile do
begin
Wnd := hWndOwner;
if strOP='COPY' then
wFunc := FO_COPY
else if strOP='MOVE' then
wFunc:=FO_MOVE
else if strOP='DELETE' then
wFunc:=FO_DELETE
else if strOP='RENAME' then
wFunc:=FO_RENAME
else
exit;
pFrom := pChar(SourceFile);
if strOP<>'DELETE' then
pTo := pChar(TargetFile)
else
pTo := #0#0;
fFlags := 0;
fAnyOperationsAborted := false;
end;
try
SHFileOperation(Info);
finally
showmessage(strOP+'错误!');
end;
end;