[SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] OnStart([/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2][] args)
{
StartWork();
}
[/SIZE][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][SIZE=2][COLOR=#808080]<summary>
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][SIZE=2][COLOR=#008000] Stop this service.
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][SIZE=2][COLOR=#808080]</summary>
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] OnStop()
{
[/SIZE][SIZE=2][COLOR=#008000]// TODO: Add code here to perform any tear-down necessary to stop your service.
[/COLOR][/SIZE][SIZE=2]}
System.Timers.Timer _tmrScheduler = [/SIZE][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][SIZE=2];
[/SIZE][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] StartWork()
{
_tmrScheduler = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2] System.Timers.Timer(3000);
_tmrScheduler.Elapsed +=[/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2] System.Timers.ElapsedEventHandler(_tmrScheduler_Elapsed);
_tmrScheduler.Enabled = [/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2];
}
[/SIZE][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] _tmrScheduler_Elapsed([/SIZE][SIZE=2][COLOR=#0000ff]object[/COLOR][/SIZE][SIZE=2] sender, System.Timers.ElapsedEventArgs e)
{
MessageBox.Show("Result");
}
[/SIZE][CODE]
Remember the important thing is it must be running under Local System and in the Services Properties in SCM under the LogOn tab "Allow Service to inetract with Destop" should be checked.
- Jay