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

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

问题描述

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



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

解决方案

对于Vista / Win7,您的应用程序无法将文件放在程序文件/程序的子文件夹中,除非UAC已关闭或应用程序正在运行。请注意,抬高并不一定意味着以管理员身份登录。非管理员用户可以提升,管理员不一定提高。



如果应用程序尝试写入程序文件但未提升,则操作系统将阻止应用程序或虚拟化写入(将文件放在别的地方),具体取决于UAC的配置方式。任何一个都不能帮助应用程序在其尝试中成功。



所以它需要把它们放在别的地方。哪里取决于为什么要创建文件,而你没有告诉我们。您可以阅读本文了解相关选项。请注意,除了用户的AppData和漫游文件夹外,还有一个所有用户(共享)配置文件。



你应该看看本文和屏幕截图,它从Delphi的角度深入讨论了UAC。


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."

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.

解决方案

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.

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.

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.

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天全站免登陆