Hi Delphi experts!
Here is my code:
uses ShellAPI;
procedure TMainForm.RecycleBin(FileToRecycle: string);
var
SHF: TSHFileOpStruct;
begin
with SHF do begin
Wnd := Application.Handle;
wFunc := FO_DELETE;
pFrom := PChar(FileToRecycle);
fFlags := FOF_NOCONFIRMATION or FOF_ALLOWUNDO;
end;
SHFileOperation(SHF);
end;
Some file works well with this proc, but others I get this error msg:
Cannot delete file: Cannot read from the source file or disk
But the source is there and the FileToRecycle path is correct..
Any ideas?? or other methods to delete file to recycle bin??
Millions of thanks
Michael
Here is my code:
uses ShellAPI;
procedure TMainForm.RecycleBin(FileToRecycle: string);
var
SHF: TSHFileOpStruct;
begin
with SHF do begin
Wnd := Application.Handle;
wFunc := FO_DELETE;
pFrom := PChar(FileToRecycle);
fFlags := FOF_NOCONFIRMATION or FOF_ALLOWUNDO;
end;
SHFileOperation(SHF);
end;
Some file works well with this proc, but others I get this error msg:
Cannot delete file: Cannot read from the source file or disk
But the source is there and the FileToRecycle path is correct..
Any ideas?? or other methods to delete file to recycle bin??
Millions of thanks
Michael