应用程序仅在您以管理员身份运行时运行?

发布于 2024-11-13 07:03:08 字数 442 浏览 5 评论 0原文

编辑:据我所知,此问题仅发生在 Windows 7 和 Vista 上。

我有一个使用外部图形库开发的非常简单的应用程序。如果我将此应用程序安装到程序文件目录中并运行它,它会立即崩溃,但它可以正常工作,具有完全相同的文件。我意识到这是因为您需要以管理员身份运行该应用程序才能正常工作。

如果这是与我正在使用的图形引擎直接相关的问题,我很感激,但我真的不这么认为(但我一无所知)。谁能帮助我吗?

编辑更多详细信息:
应用程序可执行文件和运行它所需的文件安装到默认程序目录中 - 对我来说,C:\Program Files (x86)。如果您尝试运行而不单击以管理员身份运行,它会简单地冻结并显示“应用程序已停止工作。Windows 正在检查问题的解决方案...”我的问题基本上是,我该如何做到这一点那么不需要以管理员身份运行吗?

Edit: This problem only occurs on windows 7 and vista from what I've heard.

I have a very simple app developed with an external graphics library. If I install this app into a program files directory and run it, it will crash immediately but it works fine normally, with exactly the same files. I have realised it is because you need to run the application as administrator for it to work.

I appreciate if this is a problem directly related to the graphics engine I am using, but I don't really think so (but I'm clueless). Can anyone help me?

Edit for more detail:
The application executable and files that are needed to run it are installed into the default program directory - for me, C:\Program Files (x86). If you try and run with without clicking run as administrator, it will simple freeze and say "App has stopped working. Windows is checking for a solution to the problem..." My question is basically, how can I make it so run as administrator isn't necessary?

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

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

发布评论

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

评论(3

嘦怹 2024-11-20 07:03:08

当程序无法执行某项操作时,它(该操作)应该正常失败。我的猜测是您的应用程序正在尝试执行普通用户无法执行的操作,然后无法检查返回代码,然后崩溃。您需要确定您的程序正在执行的操作是普通用户无法执行的操作。例如(我突然想到):

  • 将文件写入 Program Files (x86)
  • 写入 HKLM

When a program cannot perform an operation, it (the operation) should fail gracefully. My guess is your application is attempting to do something that it cannot do as a normal user and then fails to check for a return code, and then subsequently crashes. You need to identify what it is your program is doing that it should not be able to do as a normal user. For example (off the top of my head):

  • Write a file to Program Files (x86)
  • Write to HKLM
烟花肆意 2024-11-20 07:03:08

(没有更多详细信息)该问题很可能与您的程序尝试写入目录,然后期望文件创建/修改实际产生效果有关。 UAC 会阻止应用程序在没有管理员权限的情况下写入 Program Files 目录。解决方案是重新设计您的应用程序,使其不依赖此类行为或将有问题的文件存储在预期位置之一(AppData 等文件夹)。

(Without more details) The problem is most likely related to the fact that your program tries to write into the directory and then expects the file creation/modification to actually have an effect. UAC prevents applications from writing the Program Files directories without administrator privileges. The solution is to redesign your application to not rely on such behavior or store the files in question in one of the intended locations (AppData, etc. folders).

笑饮青盏花 2024-11-20 07:03:08

如果右键单击 EXE 并转到 Properties ->兼容性 有一些选项可能会有所帮助。您可以尝试在以前的 Windows 版本的兼容模式下运行该应用程序,或者如果这不起作用,至少将 EXE 标记为默认以管理员身份运行。

If you right-click on the EXE and go to Properties -> Compatibility there are some options that might help. You could try running the app in compatibility mode for a previous Windows version or if that doesn't work at least mark the EXE to run as administrator by default.

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