如何设置一个程序在启动时启动 [英] How do I set a program to launch at startup

查看:253
本文介绍了如何设置一个程序在启动时启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个复选框选项的小应用程序,用户可以设置,如果他们希望应用程序启动与Windows。

I have a small application with a CheckBox option that the user can set if they want the app to start with Windows.

我的问题是我怎么实际设置的应用程序在启动时运行。

My question is how do I actually set the app to run at startup.

PS:我使用C#在.NET 2.0

ps: I'm using C# with .NET 2.0.

推荐答案

三个选项,在preferrence的顺序为:

Three options, in order of preferrence:


  1. 将它添加到当前用户的启动文件夹。这需要你的应用程序运行最小权限,为用户提供了这是怎么回事的多数控制和反馈。向下的一面是,这是一个有点难度确定是否显示复选框已选中下一次他们查看该屏幕在你的程序。

  2. 将它添加到 HKEY_CURRENT_USER \\软件\\微软\\的Windows \\ CurrentVersion \\ Run中注册表项。这里唯一的问题是它需要写访问注册表,这并不总是可用的。

  3. 设置它为Windows服务。只有当你的做到这一点真的的意思是,的你肯定知道要运行这个程序的计算机上的所有的用户。

  1. Add it to the current user's Startup folder. This requires the least permissions for your app to run, and gives the user the most control and feedback of what's going on. The down-side is that it's a little more difficult determining whether to show the checkbox already checked next time they view that screen in your program.
  2. Add it to the HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\Run registry key. The only problem here is that it requires write access to the registry, which isn't always available.
  3. Set it up as a windows service. Only do this if you really mean it, and you know for sure you want to run this program for all users on the computer.

这篇关于如何设置一个程序在启动时启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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