启动计算机时自动启动c#应用程序 [英] Automatically start my c# application when i start my computer

查看:61
本文介绍了启动计算机时自动启动c#应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何做.....

How i can make.....
Automatically start my c# application when i start my computer?

推荐答案

首先添加注册表项的对象....


First add the object of the registrykey....


RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);



//在页面中加载
//将项目启动为启动



//In the page load
//Activate the project as startup

rkApp.SetValue("AppName", Application.ExecutablePath.ToString());


//停用项目


//deactivate the project

rkApp.DeleteValue("AppName", false);


请参阅:
如何在启动时运行程序? [ ^ ]
See :
How to run a program at startup?[^]


您需要添加一个注册表项.最好在安装应用程序时添加注册表项,然后在联合国安装时删除注册表项.

Registry.SetValue(@" HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion
\ Run","StartUpName",@"C:\ StartUpApplication.exe");

上面的代码为所有用户添加了自动启动条目.如果要为特定用户添加,则更改"HKEY_LOCAL_MACHINE". < b></b>
You need to add a registry entry. It good to add registry entry at the time of installation of application and remove at the UN-installation time.

Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
\Run","StartUpName",@"C:\StartUpApplication.exe");

The above code adds the auto start entry for all users. if You want to add for particular user then change "HKEY_LOCAL_MACHINE" to "HKEY_CURRENT_USER".<b></b>


这篇关于启动计算机时自动启动c#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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