gpt4 book ai didi

delphi - Windows 资源管理器在复制并找到现有文件时重命名文件

转载 作者:行者123 更新时间:2023-12-03 15:20:57 25 4
gpt4 key购买 nike

Windows 资源管理器在复制时重命名文件并找到现有文件 - 我们是否可以从 Delphi 代码访问该功能?

使用 TFile.Copy() 时,编写重命名目标文件名的代码相当简单,但如果可用,最好使用现有代码。

最佳答案

IFileOperation是 shell 文件复制功能的 API。用它来复制 shell 的行为。在您的情况下,您需要使用 SetOperationFlags指定 FOF_RENAMEONCOLLISION 标志:

Give the item being operated on a new name in a move, copy, or rename operation if an item with the target name already exists.

关于delphi - Windows 资源管理器在复制并找到现有文件时重命名文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38326432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com