netskeen
May 7th, 2002, 08:43 AM
First off, forgive me for I am a newbie,
I have created a windows service that works (had it fire 'Beep()' every 3 seconds to test. But What I need it to do is launch an application on a win2000 machine. I'm using this codebelow. I have the service starting under the Administrator account and the proccess starts (I see it in task manager) but no window appears. This code works if I compile it as a simple executable (not a windows service). Does anyone know why I cannot get an application window to appear if I have the windows service run this code? any help greatly appreciated.
Thanks
Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim MyController As New ServiceController("fax")
' Declare and instantiate a new process component.
Dim myproc As System.Diagnostics.Process
myproc = New System.Diagnostics.Process()
' Do not receive an event when the process exits.
myproc.EnableRaisingEvents = False
' Start Internet Explorer, passing in a Web page.
myproc.Start("IExplore.exe", "http://www.microsoft.com")
myproc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
End Sub
I have created a windows service that works (had it fire 'Beep()' every 3 seconds to test. But What I need it to do is launch an application on a win2000 machine. I'm using this codebelow. I have the service starting under the Administrator account and the proccess starts (I see it in task manager) but no window appears. This code works if I compile it as a simple executable (not a windows service). Does anyone know why I cannot get an application window to appear if I have the windows service run this code? any help greatly appreciated.
Thanks
Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim MyController As New ServiceController("fax")
' Declare and instantiate a new process component.
Dim myproc As System.Diagnostics.Process
myproc = New System.Diagnostics.Process()
' Do not receive an event when the process exits.
myproc.EnableRaisingEvents = False
' Start Internet Explorer, passing in a Web page.
myproc.Start("IExplore.exe", "http://www.microsoft.com")
myproc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
End Sub