I'm building a rather specialized screen saver application for some kiosks running Windows XP. Users tend to leave the kiosks without returning the browser to the homepage, so the screen saver does the following:
- Launches via the standard screen saver mechanism
- Notifies the user that there has been no recent activity, and that the browser will close in X seconds.
- If X seconds passes without user activity, the screen saver kills all current browser instances (via Process.GetProcessesByName) and starts a new instance of the browser that points to the configured web site (via Process.Start).
- The screen then "blanks out" until a user moves the mouse or presses a key - at this point the screen saver application exits.
When this runs on Windows Vista or 2008, everything works as expected.
However, on Windows XP (which is what the kiosks are running), when the screen saver application exits, the browser process is killed. If I add a Thread.Sleep just before the screen saver exists, I can see and interact with the browser up until the point at which the screen saver exits.
To make matters more confusing, Windows XP does NOT exhibit this behavior when I run the screen saver by clicking the "Preview" button in the settings area - that is, it behaves as expected. The exact same code is run in this case.
I tested this under the .NET 2.0 framework, and later installed .NET 2.0 SP1. On the Windows 2008 workstation, I have 3.5 SP1.
Is there some difference between these versions of .NET with respect to dependencies on launched processes? Is there some flag I can set to make sure that the launched browser process is not "attached" to the screen saver application?