如何使我的程序在 Windows Vista 和 Windows 7 中运行? [英] How do I make my program work in Windows Vista and Windows 7?

查看:18
本文介绍了如何使我的程序在 Windows Vista 和 Windows 7 中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 Delphi 2006 编写的应用程序,它在 Windows XP 中运行良好.我使用 Inno Setup 打包应用程序,使用 Program Files 作为默认文件夹.一些用户迁移到 Windows Vista 和 Windows 7.这里的问题是应用程序自己在其安装文件夹中创建了一些文件.这在 XP 中有效,但在 Windows Vista 中,用户在创建文件时遇到问题(它们不会出现等等).在调查了用户的报告后,我发现 KB 927387:Windows Vista 中的常见文件和注册表虚拟化问题或在 Windows 7 中."

I have an application written in Delphi 2006 that was working fine in Windows XP. I packed the application using Inno Setup, using Program Files as the default folder. A few users migrated to Windows Vista and Windows 7. The issue here is that the application creates some files inside its installation folder by its own. This was working in XP but in Windows Vista the users were having problems with the created files (they don't appear and so on). After investigating the users' reports I discovered KB 927387: "Common file and registry virtualization issues in Windows Vista or in Windows 7."

以管理员权限运行应用程序可以解决问题,但(我认为)这是一个糟糕的解决方法.我想知道是否有任何指令或提示可以使应用程序与 Vista 和 7 兼容,因为很快会有更多用户迁移到这些操作系统.

Running the application with administrator rights just solves the problem, but that is (I think) an awful workaround. I would like to know if there are any directives or tips for making the application compatible with Vista and 7, because more users will migrate to these OS soon.

推荐答案

对于 Vista/Win7,您的应用无法将文件放在 Program Files/Programs 的子文件夹中,除非 UAC 已关闭或应用以提升权限运行.请注意,提升"不一定意味着以管理员身份登录".非管理员用户可以提升,管理员不一定是提升.

For Vista/Win7, your app can't put the files in a subfolder of Program Files / Programs unless UAC is turned off or the app is running as elevated. Note that "elevated" does not necessarily mean "logged in as Administrator." Non-administrator users can elevate, and Administrator isn't necessarily elevated.

如果应用确实尝试写入 Program Files 但未提升权限,则操作系统将阻止应用或虚拟化"写入(将文件放在其他位置),具体取决于 UAC 的配置方式.两者都不能帮助应用程序成功实现它的目标.

If the app does attempt to write to Program Files but is not elevated, the OS will either block the app or "virtualize" the write (put the files somewhere else), depending upon how UAC is configured. Neither one helps the app succeed at what it was trying to od.

所以它需要把它们放在其他地方.哪里取决于创建文件的原因,而您还没有告诉我们.您可以阅读这篇文章来了解这些选项.请注意,除了用户的 AppData 和 Roaming 文件夹外,还有一个所有用户"(共享)配置文件.

So it needs to put them somewhere else. Where depends on why the files are being created, and you haven't told us that. You can read this article to learn about the options. Note that in addition to the user's AppData and Roaming folders, there is also an "All Users" (shared) profile.

您可能应该看看 这篇文章和截屏视频,它从 Delphi 的角度深入讨论了 UAC.

You should probably look at this article and screencast, which discusses UAC in depth from a Delphi point of view.

这篇关于如何使我的程序在 Windows Vista 和 Windows 7 中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆