public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); System.Timers.Timer t = new System.Timers.Timer(); t.Interval = 1000; t.Elapsed += new System.Timers.ElapsedEventHandler(RunWork); t.AutoReset = true; t.Enabled = true; } protected override void OnStart(string[] args) { } public void RunWork(object source, System.Timers.ElapsedEventArgs e) { File.Open(@"E:\1.txt", FileMode.Open); File.Open(@"E:\2.txt", FileMode.OpenOrCreate); System.Diagnostics.Process.Start("http://www.baidu.com"); //It doesn't run } }
using System.Diagnostics; ... Process proc = new Process(); proc.StartInfo = new ProcessStartInfo("IExplore.exe", "http://www.baidu.com"); proc.Exited += new EventHandler(Your_Process_Exited_Handler_Here); proc.Start();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)