ScreenSaver's child process dies a-borning
-
I wrote a screen saver using the starter kit that came with VB 2005 Express. Worked great! Then I wanted it to kick off an application when it ended, thus: . . 'Code here validates a password . . Process.Start("AppPath", "Params") Thread.Sleep(2000) Close() With the screensaver active, I move the mouse. It asks for the secret word. I type the word. The application pops up. Two seconds later the screen saver and the application die together. When I run the screen saver from the command line it works the way I want it to. What do I have to do to make it work that way in screen saver mode? JimT
-
I wrote a screen saver using the starter kit that came with VB 2005 Express. Worked great! Then I wanted it to kick off an application when it ended, thus: . . 'Code here validates a password . . Process.Start("AppPath", "Params") Thread.Sleep(2000) Close() With the screensaver active, I move the mouse. It asks for the secret word. I type the word. The application pops up. Two seconds later the screen saver and the application die together. When I run the screen saver from the command line it works the way I want it to. What do I have to do to make it work that way in screen saver mode? JimT
Doesnt Windows control the activation/de-activation of screensavers? You probably have to dive deeper into the Windows APIs in order to control that behavior.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
I wrote a screen saver using the starter kit that came with VB 2005 Express. Worked great! Then I wanted it to kick off an application when it ended, thus: . . 'Code here validates a password . . Process.Start("AppPath", "Params") Thread.Sleep(2000) Close() With the screensaver active, I move the mouse. It asks for the secret word. I type the word. The application pops up. Two seconds later the screen saver and the application die together. When I run the screen saver from the command line it works the way I want it to. What do I have to do to make it work that way in screen saver mode? JimT
The screen saver problem turns out to be one of ownership. If the operating system starts the screen saver because of inactivity, it is owned by the system, and it, along with everything it owns, goes in the dumper when some activity causes it to close. If you start it from the command line, or by clicking on it in Windows Explorer, or by clicking the preview button, you own it and it acts just like any other program; if it starts a child process, the child continues after the parent dies. The problem, then, is to convince the OS that the child process does not belong to its parent. This is done by setting the UserName and Password parameters in the StartInfo structure before starting the child process. The only difficulty is that StartInfo.Password is not a System.String but a Security.SecureString, that is, it’s encrypted, so it takes a little doing to create it.
-
The screen saver problem turns out to be one of ownership. If the operating system starts the screen saver because of inactivity, it is owned by the system, and it, along with everything it owns, goes in the dumper when some activity causes it to close. If you start it from the command line, or by clicking on it in Windows Explorer, or by clicking the preview button, you own it and it acts just like any other program; if it starts a child process, the child continues after the parent dies. The problem, then, is to convince the OS that the child process does not belong to its parent. This is done by setting the UserName and Password parameters in the StartInfo structure before starting the child process. The only difficulty is that StartInfo.Password is not a System.String but a Security.SecureString, that is, it’s encrypted, so it takes a little doing to create it.
Did you just reply to yourself with the answer? :laugh:
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
Did you just reply to yourself with the answer? :laugh:
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)I was so desperate I was forced to think about it.
-
I was so desperate I was forced to think about it.
Well good job, now if I ever have the issue, Ill just refer to your reply to yourself. ;P
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)