简体   繁体   English

没有窗口的后台进程

[英]Background process without a window

I need to prepare a program which runs in the background without a window or anything on the taskbar. 我需要准备一个程序,该程序在后台运行,没有窗口或任务栏上的任何东西。 You may compare this to the idea of a program which runs in the background and sends a signal every once in a while to keep the computer from sleeping. 您可以将其与在后台运行并每隔一段时间发送一次信号以防止计算机进入休眠状态的程序的想法进行比较。 So here are the two ideas that I have on my mind 所以这是我的两个想法

1) Creating a windows Service
2) Spawning a thread and exiting main

Please let me know how viable these are, particularly the second one, and what other possibilities do we have at our disposal. 请让我知道它们的可行性,尤其是第二种可行性,以及我们还有其他可用的可能性。

Thanks in advance!! 提前致谢!!

If you're looking to run a background process then go with the service approach. 如果您要运行后台进程,请使用服务方法。 You'll be able to configure it to run even when nobody is logged in and it won't be intrusive to the user. 您可以将其配置为即使没有人登录也可以运行,并且不会干扰用户。

只需将您的应用程序链接到windows子系统,而不是console

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM