Mega Code Archive

 
Categories / Delphi / System
 

Dosyayi windows recycle bine göndermek

function SendToRecycleBin(FileToRecycle: TFilename): boolean; var Struct: TSHFileOpStruct; pFromc: array[0..255] of char; Resultval: integer; begin if not FileExists(FileToRecycle) then begin Result := False; exit; end else begin fillchar(pfromc,sizeof(pfromc),0); StrPcopy(pfromc,expandfilename(FileToRecycle)+#0#0); Struct.wnd := 0; Struct.wFunc := FO_DELETE; Struct.pFrom := pFromC; Struct.pTo := nil; Struct.fFlags:= FOF_ALLOWUNDO; Struct.fAnyOperationsAborted := false; Struct.hNameMappings := nil; Resultval := ShFileOperation(Struct); Result := (Resultval = 0); end; end;