简体   繁体   中英

How do I keep a program alive with timers?

I have a program that its' only action is calling a function every 24 hours. Obviously, I've been trying to use timers for that cause. However the program ends before the function is called for the first time (because the main thread ends first). Is there a way of keeping a program alive just with timers?

不要让程序运行24小时,请在需要的时间使用计划的任务,然后执行程序。

If you really want a program to continually run on Windows and do something at a certain time.. write a service. Here's a tutorial:

http://www.codeproject.com/Articles/3938/Creating-aC-Service-Step-by-Step-Lesson-I

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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