本文介绍了仅当以管理员身份运行时,应用程序才会运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:此问题只出现在Windows 7和vista上。



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



我感谢如果这是与我使用的图形引擎直接相关的问题,但我真的不这么认为(但我没有丝毫)。任何人都可以帮助我?



编辑更多细节:

应用程序可执行文件和运行它所需的文件安装到默认程序目录 - 对我来说,C:\Program Files(x86)。如果你尝试并运行没有点击作为管理员运行,它会简单的冻结和说应用程序已停止工作。Windows正在检查解决问题...我的问题基本上,我如何使它

解决方案

当程序无法执行操作时, )应该失败。我的猜想是你的应用程序正在尝试做一些它不能作为一个普通用户,然后无法检查返回代码,然后崩溃。你需要确定你的程序在做什么,它不应该作为一个普通用户。例如(在我的头顶):




  • 将一个文件写入程序文件(x86)

  • 写入HKLM


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?

解决方案

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

这篇关于仅当以管理员身份运行时,应用程序才会运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:16