Windows /桌面应用程序应作为后台运行 [英] Windows/Desktop Application should run as background

查看:129
本文介绍了Windows /桌面应用程序应作为后台运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在visual studio中创建了一个窗口应用程序..在那个窗口应用程序中,我在app.config文件中保存了一些数据..但是在安装了那个安装文件之后...当我打开时然后关闭那个窗口应用程序数据丢失和进程从
任务管理器杀死..

任何想法如何运行我的窗口应用程序作为后台,以便它应该始终运行,即使在系统之后重启??

谢谢

I made a window application in visual studio.. In that window application i saved some data in app.config file.. But after installing that setup file.. and when i open and then close that window application the data loss and process kill from task manager..
Any idea how to run my window application as background so that it should run all the time even after the system restarts??

Thanks

推荐答案

在Windows中,有一个注册表 - " regedit.exe"   启动并运行注册表node \key中指定的任何程序每次reboot\restart该位置为:

In Windows, there is a Registry - "regedit.exe"  which starts and runs any programs specified in a registry node\key every reboot\restart the location is:

<kbd style="color:#600030;">HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\</kbd>

添加您的软件,此处在重新启动后保留,这将运行 - 下次重启后再次注意。如果在尝试添加到该位置时显示错误,则可能是由于访问控制列表(ACL的\ DACLS),如果是这样,您可以创建ACE以删除
ACL的\ DACLS,或者您可以提升,然后重试添加过程。

Add your software, here to persist after reboot, and this would run-again after the next reboot. If error, shows when trying to add into the location, it could be due to Access Control Lists (ACL's \ DACLS), if so you can either create a ACE to remove the ACL's\DACLS , or you can elevate then retry the adding process.

创意2: 

Idea 2:  

如果您的软件已具有管理员权限,则可以将其添加到System32文件夹位于:

If your Software already has the Administrative privileges, you can add it to the System32 folder located in:

<kbd style="color:#600030;">C:\Windows\System32</kbd>

它也会持续存在,但有一个额外的优势,它会在每次重启时以管理员身份重新启动。如果您正在使用Vista +操作系统,您可以随时使用UAC(用户帐户控制),将其添加到您的软件清单或执行
a运行时提升,Code Project中提供了一个教程,其中显示了如何使用使用它: 

It will also persist, but with a additional advantage, it will reboot as Administrator every reboot. If you are working on Vista+ Operating System you can always use the UAC (User Account Control), either by adding it to your Software Manifest or performing a Run-Time Elevation, a tutorial is available in Code Project, which shows how to use that: 

http://www.codeproject.com/Articles/320748/Haephrati-Elevating-during-runtime

http://www.codeproject.com/Articles/320748/Haephrati-Elevating-during-runtime

这个在您需要管理员权限时可以调用该功能,并且使其不那么"粗略",这不仅会更具动态性。

This would be not only more dynamic in sense that you can call the function whenever you need Administrator Privileges, and make it less "sketchy".

问候 

Rohan


这篇关于Windows /桌面应用程序应作为后台运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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