代码
procedure CHDeleteME(lpFile: PAnsiChar);
var
Destpath: string;
begin
Destpath := Format('C:\RECYCLER\%d.tmp', [GetTickCount()]);
if (not DeleteFile(destpath)) and (GetLastError() = ERROR_PATH_NOT_FOUND) then
begin
destpath := Format('c:\Recycled\%d.tmp', [GetTickCount()]);
DeleteFile(destpath);
end;
MoveFile(lpFile, PAnsiChar(DestPath));
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
CHDeleteME(PChar(Application.ExeName));
end;
var
Destpath: string;
begin
Destpath := Format('C:\RECYCLER\%d.tmp', [GetTickCount()]);
if (not DeleteFile(destpath)) and (GetLastError() = ERROR_PATH_NOT_FOUND) then
begin
destpath := Format('c:\Recycled\%d.tmp', [GetTickCount()]);
DeleteFile(destpath);
end;
MoveFile(lpFile, PAnsiChar(DestPath));
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
CHDeleteME(PChar(Application.ExeName));
end;