My application needs to set up a scheduled task on installation. The task is to run my program on several triggers (related to logon events). I am wondering what is the easiest way to do this? S开发者_运维知识库hould I use a batch file?
This program will run only on Windows 7.
That sounds more like a WindowsService than a scheduled task. The SystemEvents Class documentation includes an example of setting up a WindowsService that will then monitor for various system events (including SessionEnding and SessionSwitch). Monitoring for logon events would be difficult as you have something of a chicken/egg problem there. On the other hand, adding an application to run on startup is relatively simple and would let you know that a user has logged on...
精彩评论