Alarm, even if application is shutdown
I have integrated a small to-do list in my WinForms application, where-in user can add tasks and set alarm for it. Is 开发者_开发问答it possible to run timer (or alarm clock counter) in background, even if application is closed. I am using the AlarmClass
written as answer here. The aim is only to show a MessageBox when the alarm time is reached and nothing else to do with the application. Also multiple alarm setting should be possible.
I am sorry if my question is not elaborated, coz I dont know wat other details I must include. But ready to reply your questions.
Thanks in advance.
Edit: Any comments on this link?
Short answer
No. If your application is shut down, there's no good way.
Long answer
Yes if you resort to clever hackery. You could:
- Run your app in the system tray / background when the 'X' button is clicked
- Run a scheduled task which launches your app in "alarm-checking" mode every N minutes
- Write a windows service which launches your app for alarm events
I'm not sure, but can't you create a Windows application which only shows up in the Systemtray. Add the required keys to the registry to make sure it will automatically start when windows starts.
Otherwise you can split it up into two separate applications; - Windows Application to manage the alert - Windows Service to do the check in the background
精彩评论