lagerg

lagerg

  • NA
  • 9
  • 0

Having a Problem starting an Application from a Service

Sep 26 2003 1:31 PM
I have used this code successfully in a form application. I tried to add the same code in a service and have not been able to get the application to start. I have the service starting with a local account and the Interact with the Desktop is Checked. Windows media player seems to start but then closes almost immediately. I would appreciate any help. Thanks, Glenn private void InitializeComponent() { this.p = new System.Diagnostics.Process(); this.p.EnableRaisingEvents = true; this.p.StartInfo.FileName = "C:\\Program Files\\Windows Media Player\\wmplayer.exe"; this.p.StartInfo.RedirectStandardError = true; this.p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized; this.p.StartInfo.UseShellExecute = true; this.p.SynchronizingObject = this; this.p.Exited += new System.EventHandler(this.p_Exited); // Manager // this.ServiceName = "Manager"; ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit(); }// end of InitializeComponent private void p_Exited(object sender, System.EventArgs e) { try { p.Start(); } catch(Exception e1) { MessageBox.Show(e1.Message.ToString(),"Error",MessageBoxButtons.OK,MessageBoxIcon.Error); } }// end of p_Exited public void Startup() { p.Start(); }

Answers (2)