Jump to content
Sign in to follow this  

Spawned program terminates when script terminates

Recommended Posts


I am trying to produce a script that will be executed when the Windows screen saver triggers, so that when the computer is idle the mail client program (e.g. Thunderbird, Eudora, etc) is activated. By this I mean that if a mail client process exists its window is activated by WinActivate(...), but if the process does not exist then the mail client is invoked by either Run(...) or ShellExecute(...).

I have a screensaver (Screen Launcher from http://www.bartdart.com) that can invoke any specified program; I have set it to invoke the compiled script, which works up to a point.

If the mail client is not running and I manually execute the compiled script then everything behaves as expected, the mail client is invoked and it continues to run when the script terminates. However, if the compiled script is invoked by the screensaver, then the script activates and invokes the mail client program, but the mail client program terminates as soon as the script terminates. I have demonstrated this by using varying Sleep(..) delays immediately following the Run or ShellExecute functions.

It appears that if the compiled script is invoked by the screen saver, then the mail client is not spawned as an independent process, but if it is manually invoked the the mail client is spawned as an independent process.

Can anyone explain this behavior, and/or suggest a way of overcoming it?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this