获取用户当前的Windows临时文件夹
function GetWinTempPath: string;
var
TempDir: array[0..255] of char;
begin
GetTempPath(255, @TempDir);
Result := strPas(TempDir);
end;

删除目录:(目录里有东西也一样删)(shellapi)

function DelDirectory(const Source: string): boolean;
var
fo: TSHFILEOPSTRUCT;
begin
FillChar(fo, SizeOf(fo), 0);
with fo do
begin
    Wnd := 0;
    wFunc := FO_DELETE;
    pFrom := PChar(source + #0);
    pTo := #0#0;
    fFlags := FOF_NOCONFIRMATION + FOF_SILENT;
end;
Result := (SHFileOperation(fo) = 0);
end;

创建目录和设置目录属性
var
iFileAttrs: Word;

iFileAttrs := faSysFile + faHidden;
ForceDirectories(ExtractFilePath(Application.Exename) + 'temp\');//如存在目录就不创建.
FileSetAttr(ExtractFilePath(Application.Exename) + 'temp\', iFileAttrs);

相关文章:

  • 2022-12-23
  • 2021-08-19
  • 2021-10-04
  • 2022-02-15
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2021-03-31
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案