uses shellapi;

procedure DeleteFileForApi(aFilePath: string);
var
  T: TSHFileOpStruct;
  LFilePath: string;
begin
  //inherited;
  LFilePath := aFilePath;
  if fileexists(LFilePath) then
  begin
    with T do
    begin
      Wnd := 0;
      wFunc := FO_DELETE;
      pFrom := Pchar(LFilePath + #0);
      pTo := nil;
      fFlags := FOF_ALLOWUNDO or FOF_SIMPLEPROGRESS; //标志表明允许恢复,FOF_NOCONFIRMATION + FOF_NOERRORUI 无须确认并不显示出错信息
      hNameMappings := nil;
      lpszProgressTitle := '正在删除文件';
      fAnyOperationsAborted := False;
    end;
    SHFileOperation(T);
  end;
end;

相关文章:

  • 2022-12-23
  • 2021-05-16
  • 2021-10-24
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-05-31
  • 2022-12-23
相关资源
相似解决方案