如何制作启动操作系统时启动的启动程序 [英] how to make start up program which starts when os starts
问题描述
假设我有一个可以执行某些操作的C#程序,
Say i ve a C# program which does something,
我希望该程序单独运行,或者在计算机启动时自动开始执行.
I want this program keep running by itself or start executing automatically when the computer starts.
以及如何使该程序不可检测,即,不能在任务管理器的进程列表中检测到该程序.
And how can i make this program not detectable i.e., it must not be detected in task manager's process list.
说我有一个程序可以在Windows窗体上显示随机数.
say i ve a program which displays random number on the windows forms.
for(;;)
{
Random random = new Random();
int randomNumber = random.Next(0, 100);
}
我希望该程序在计算机启动时运行,并一直运行到计算机关闭为止.我不希望用户终止它的操作.
i want this program to run when computer starts and keep on running till the computer shutdowns. i dont want user to terminate it how to do it.
推荐答案
听起来您想创建一个 Windows服务
在这里查看更多信息:
http://msdn.microsoft.com/en-us/library/zt39148a(v=VS.80).aspx
http://www.codeproject.com/Articles/14353/Creating-a-Basic-Windows-Service-in-C
http://www.c-sharpcorner.com/UploadFile/mahesh/window_service11262005045007AM/window_service.aspx
值得注意的是Windows不允许您创建用户无法终止的服务.这是由于安全性和性能.至少据我所知,唯一无法停止的服务类型是系统驱动程序.
It is worth noting that Windows will not let you create a service that the user cannot terminate. This is due to security and performance. The only types of services that cannot be stopped, at least to my knowledge, are system drivers.
这篇关于如何制作启动操作系统时启动的启动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!