TFileListBox 组件查找不再存在的文件

发布于 2024-11-24 19:35:20 字数 337 浏览 2 评论 0原文

我在 Windows 7 上使用 Delphi 7,并且有一个应用程序使用 TFileListBox 组件来迭代目录中的文件并将它们复制到备份目录。

我遇到一些奇怪的行为,TFileListBox 正在检测目录中不存在的文件?我正在处理的目录包含 75 个文件,但 TFileListBox 检测到超过 100 个文件。

我更改了资源管理器设置以显示隐藏/系统文件,但仍然无法看到这些额外文件的来源。

我想知道 Windows 7 以前的版本是否在这个问题中发挥了作用,因为我相当确定 TFileListBox 检测到的额外文件确实曾经驻留在该目录中但已被删除...

对此的任何帮助都会很大赞赏。

I am using Delphi 7 on Windows 7 and have an application which uses a TFileListBox component to iterate through files in a directory and copies them to a backup directory.

I'm experiencing some strange behavior whereby the TFileListBox is detecting files which do not exist within the directory?? The directory I am coping from contains 75 files but the TFileListBox detects over 100 files.

I changed my explorer settings to display hidden/system files but still cannot see where these extra files are coming from.

I was wondering whether this Windows 7 Previous Versions was playing a part in this problem as I am fairly sure that the extra files the TFileListBox is detecting did used to once reside in this directory but were deleted...

Any help on this would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

¢蛋碎的人ぎ生 2024-12-01 19:35:20

我们从上面的评论中发现,该问题与应用程序虚拟化时使用的虚拟存储有关。虚拟商店是随 Windows Vista 一起引入的,作为无需管理员权限即可运行应用程序的一部分。这些文件出现在虚拟存储中是因为您的应用程序正在写入程序文件目录,而标准用户没有写入权限。

虚拟化的引入是为了帮助处理那些不会重新编译以考虑新 Vista 策略的遗留应用程序。如今您根本不应该构建虚拟化应用程序。

您可以通过将应用程序清单链接到包含 部分的应用程序来禁用虚拟化。

当您这样做时,您无疑会发现一些其他问题,因为您的应用程序可能会尝试写入程序文件目录、注册表的 HKLM 部分等。虽然进行这些更改可能看起来很痛苦,但它们是值得的。

We have worked out from the comments above that the issue is related to the Virtual Store which is used when your application is virtualized. The virtual store was introduced with Windows Vista as part of the move to running applications without administrator rights. These files are appearing in the virtual store because your application is writing to the program files directory, to which standard users do not have write privileges.

Virtualization was introduced to help deal with legacy applications that were not going to be recompiled to take account of the new Vista policies. Nowadays you simply should not be building a virtualized application.

You can disable virtualization by linking an application manifest to your application that includes the <requestedExecutionLevel level="asInvoker"/> section.

When you do this, you will no doubt find some other problems because your application may attempt to write to the program files directory, the HKLM section of the registry, etc. Whilst it may seem painful to make these changes, they are worth the effort.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文