Search results for 'File Delete with UNDO'. 1 post(s) found.
- 2007/09/10 Delete files with the ability to UNDO
Here's a Delphi procedure that can delete a file with the ability to undo by sending the file to the "Recycle Bin."
Function FileDeleteRB will return True if the operation was successful.
uses ShellAPI;
function FileDeleteRB( AFileName:string): boolean;
var Struct: TSHFileOpStruct;
pFromc: array[0..255] of char;
Resultval: integer;
begin
if not FileExists(AFileName) then begin
Result := False;
exit;
end
else begin
fillchar(pfromc,sizeof(pfromc),0) ;
StrPcopy(pfromc,expandfilename(AFileName)+#0#0) ;
Struct.wnd := 0;
Struct.wFunc := FO_DELETE;
Struct.pFrom := pFromC;
Struct.pTo := nil;
Struct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION
or FOF_SILENT;
Struct.fAnyOperationsAborted := false;
Struct.hNameMappings := nil;
Resultval := ShFileOperation(Struct) ;
Result := (Resultval = 0) ;
end;
end;
function FileDeleteRB( AFileName:string): boolean;
var Struct: TSHFileOpStruct;
pFromc: array[0..255] of char;
Resultval: integer;
begin
if not FileExists(AFileName) then begin
Result := False;
exit;
end
else begin
fillchar(pfromc,sizeof(pfromc),0) ;
StrPcopy(pfromc,expandfilename(AFileName)+#0#0) ;
Struct.wnd := 0;
Struct.wFunc := FO_DELETE;
Struct.pFrom := pFromC;
Struct.pTo := nil;
Struct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION
or FOF_SILENT;
Struct.fAnyOperationsAborted := false;
Struct.hNameMappings := nil;
Resultval := ShFileOperation(Struct) ;
Result := (Resultval = 0) ;
end;
end;
Another posts included in "Delphi"
| Delete folders recursively (0) | 2007/09/10 |
| From/to the 8.3 (short) format to/from the long format (0) | 2007/09/10 |
| Get File 'Last Modified' attribute (0) | 2007/09/10 |
| Does my CD-ROM drive contain an audio CD? (0) | 2007/09/10 |
| Convert a mapped drive to a full UNC path (0) | 2007/09/10 |
| Checking If File Is In Use (0) | 2007/09/10 |
| Browse for Computers, Folders, Files and Printers (0) | 2007/09/10 |
| How to draw Transparent Text on bitmap (0) | 2007/09/01 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 01:36
moneyideas
-
Subject different money making ideas
2010/01/29 09:51
moneyideas
-
Subject different money making ideas
2010/01/31 16:38
moneyideas

Prev

Rss Feed