VB.NET 2005: Service to check if application is running
Posted on 2007-03-27
I have written a Windows service that periodically checks to see if an instance of an application is running and if not, it starts the application.
The problem I am having is that the service was installed with a local user account. It looks like the service goes through the motion of checking for the instance, but I never see the application on screen and instead hear a Windows error popup sound (and really don't see an error dialog on the screen either.)
What could be the issue?
Here is my code:
myProcesses = Process.GetProcessesByName("myapp")
If myProcesses.Length = 0 Then
Dim p As ProcessStartInfo = New ProcessStartInfo("myapp.exe")
p.WorkingDirectory = "c:\exefolder"
Dim process As Process = New Process