将程序设置为启动程序 [英] setting a program as startup progam
本文介绍了将程序设置为启动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我正在尝试编写处理器管理器,我想知道如何将该程序设置为启动程序?
我搜索谷歌,在论坛上人们说程序员必须用Windows注册做一些事情,但是怎么办呢?不知道!
可以有人指导吗?
在此先感谢
hey guys
i''m trying to write a processor manager, and i want to know how i can set this program as a startup program?
i search google, and in forums peoples said that the programmer have to do something with windows register, but how? don''t know!
can any one guide on this?
thanks in advance
推荐答案
您可以创建一个注册表项,该注册表项始终在启动时执行
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run
看一下regedit可以看到那里的现有条目,因此您知道应该如何阅读.只需创建一个值并将其指向您的程序
You can create a registry key that will always be executed at startup
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Have a look in regedit to see existing entries in there so you know how it should read. Simply create a value and point it at your program
看看这个答案: ^ ]
它说,您可以在注册表中使用它.以下代码显示了如何执行此操作:
Have a look at this answer: Running a program at startup[^]
It says, you can do it usin Registry. The following code shows how to do this:
RegistryKey rk = Registry.CurrentUser;
RegistryKey StartupPath;
StartupPath = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
if (StartupPath.GetValue("ProjectName") == null)
{
StartupPath.SetValue("ProjectName", Application.ExecutablePath, RegistryValueKind.ExpandString);
}
这篇关于将程序设置为启动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文