[英]Does anyone have any good examples of a .NET program that stays memory resident and runs an action on a timer?
This program should not have a visible window, more like a daemon. 该程序不应该有一个可见的窗口,更像是一个守护进程。 (a taskbar program for instance) Any links or advice will be appreciated.
(例如任务栏程序)任何链接或建议将不胜感激。
You might want to consider writing a Windows Service . 您可能需要考虑编写Windows服务 。
If you just need to execute a specific action at certain times you could make use of the Windows Task Scheduler . 如果您只需要在特定时间执行特定操作,则可以使用Windows任务计划程序 。
If you want an icon in the system tray you could write an ordinary Windows Forms application but have the main form hidden until the user requests it. 如果您想要系统托盘中的图标,您可以编写一个普通的Windows窗体应用程序,但在用户请求之前隐藏主窗体。 This article explains how.
本文解释了如何。
或者,如果您想在计时器上运行任务,Windows任务计划程序就在它所在的位置。
When I've built applications that need this functionality before, I've always used the Windows Task Scheduler through a simple .NET library that I found. 当我以前构建需要此功能的应用程序时,我总是通过我找到的简单.NET库使用Windows任务计划程序 。
Please see my answer to a similar question for some sample code and more explanation. 有关示例代码和更多解释, 请参阅我对类似问题的回答 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.