sendte filer til genbrug

, denne artikel viser, hvordan vi kan sende et dossier til recyle bin snarere end sletter straks.,, enhed recyclebin;,,, grænseflade, anvender, vinduer, shellapi;,,, funktion recyclefile (filnavn: string; denne hurtige: boolean): boolean;, funktion recyclefiles (filer: tstrings; denne hurtige: boolean): boolean,,,, gennemførelse,,, funktion recyclefile (filnavn: string; denne hurtige: boolean): boolean,,, var struktureret: tshfileopstruct;,,,,,, resultval tmp: string;: heltal, begynder. tmp: = filnavn +��,, struct.wnd: = 0, struct.wfunc: = fo_delete;,, struct.pfrom: = pchar (tmp);,, struct.pto: = nul;,,, struktureret fflags: = fof_allowundo;,, hvis der ikke hurtigt derefter, struct.fflags: = Struct.fFlags or FOF_NOCONFIRMATION; , ,, Struct.fAnyOperationsAborted := False;,, Struct.hNameMappings := nil;,, ResultVal := ShFileOperation(Struct);,, Result := (Resultval = 0);,, end;,,, function RecycleFiles(Files: TStrings; const Prompt: Boolean): Boolean;,, var,, I: Integer;,, AllFiles: string;,, NextPos: PChar;,, begin,, Result := False;,, if Files.Count = 0 then Exit;,, SetLength(AllFiles, Length(Files.Text));,, FillChar(AllFiles[1], Length(AllFiles), 0);,, NextPos := @AllFiles[1];,, for I := 0 to Files.Count - 1 do,, begin,, Move(PChar(Files[I])^, NextPos^, Length(Files[I]));,, Inc(NextPos, Length(Files[I]) + 1);,, end;,, SetLength(AllFiles, NextPos - @allfiles [1]);,, resultat: = recyclefile (allfiles, hurtig);,,,,,



Previous:
Next Page: