using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; namespace WindowsService1 { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); timer1.Start(); } protected override void OnStart(string[] args) { timer1.Start(); } protected override void OnStop() { } //private void InitializeComponent() //{ // timer1.Start(); //} private void timer1_Tick(object sender, EventArgs e) { Console.Beep(); } static void main() { System.ServiceProcess.ServiceBase[] ServicesToRun; // More than one user Service may run within the same process. To add // another service to this process, change the following line to // create a second service object. For example, // // ServicesToRun = new System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()}; // ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)