Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 May : Error 6 Deleting Files with ShFileOperation()
| Subject: | Error 6 Deleting Files with ShFileOperation() |
| Posted by: | "Steve Harp" (kilr..@harpservices.com) |
| Date: | Tue, 16 May 2006 15:03:50 |
Hi Guys,
I'm getting and error code 6 (which I think is an invalid handle) when
deleting files. It is happening about half the time.
function DeleteAllFilesWithMask(sFile : String) : Boolean;
var
Info: TSHFileOpStruct;
lAborted : Bool;
begin
lAborted := False;
with Info do
begin
Wnd := Application.Handle;
wFunc := FO_DELETE;
pFrom := pChar(sFile);
pTo := pChar('');
fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or FOF_NOCONFIRMATION or
FOF_SILENT;
fAnyOperationsAborted := lAborted;
hNameMappings := nil;
lpszProgressTitle := nil;
end;
try
Result := (SHFileOperation(Info) = 0);
finally
if lAborted then
Result := False;
end;
end;
Is it possible for Application.Handle to provide an invalid handle? If
so, what can I use?
Thanks,
Steve