471,624 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

Screen savers: How do I spawn a new process...

I have a machine that will be used to demo some Excel spreadsheets at a
convention. Because I did not author the spreadsheets and attendees will be
allowed to play with the spreadsheets, I needed a way to periodically
restore the original versions. In addition to the "always-on-top click this
button to reset demo" application I wrote, I chose to use screen saver code
to reset the demo after a period of inactivity in the event an attendee just
walked away. I chose the screen saver method because I was unsure how to
capture the system traps since my reset-app will not always have focus and
so using the screen saver method seemed to be the quickest/easiest solution.

So...

I can spawn a new process from an application and that process remains
running after the application is closed. This is good.

Using the same code in a screen saver and running it while its an .EXE
(prior to renaming it .SCR & relocating it to the system directory), the new
process remains running after the screen saver application is closed. This
is good.

I rename the screen saver to .SCR, relocate it in the system directory,
right-click the Desktop background, select Properties / Screen Saver / etc.,
click the Preview button to execute the screen saver and the new process
remains running after I select Ok or Cancel to cancel the screen saver.
This is good.

Now I allow the system to kick off the screen saver at whatever inactivity
timeout. The screen saver executes, the new process executes but it closes
when the screen saver closes. This is bad.

Here is the code being used:

private void ScreenSaverForm_Load(object sender, System.EventArgs e)
{
string InstallPath =
(string)Registry.LocalMachine.OpenSubKey(@"SOFTWAR E\MyApp").GetValue(@"Path");
ProcessStartInfo startInfo = new ProcessStartInfo(InstallPath +
@"\MyFile.xls");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);
Close();
}

I have also tried including "startInfo.UseShellExecute = true;" but results
were the same.

Unless I am totally off then obviously the operating system is
handling/executing screen saver code differently at the final stage. Other
than basic skeleton code required for a screen saver, I am unable to find
any 'real' documentation on screen saver programming. For example, through
trial & error I discovered that the screen saver filename must follow the
8.3 naming convention - unless I'm doing something wrong there as well?
Anyway...

1. Most importantly, what is the code for spawning a new process from within
a system activated screen saver such that the new process remains running
after the screen saver closes?

2. Is a screen saver filename in fact limited to the 8.3 naming convention?

3. Where is the screen saver application name set or read from? For example;
if your filename is 'ssMyDemo.scr' then the system will drop the prefix of
'ss' and display 'MyDemo' in the screen saver list. If there is no 'ss'
then the filename, excluding extension, will display in the screen saver
list. But if you examine a default OS provided screen saver you will see
that the filename 'ss3dfo.scr' displays as '3D Flying Objects' in the screen
saver list. How is this accomplished?

4. Is there a "Everything you ever wanted to know" type source on screen
saver programming; net, book or otherwise?

TIA,
-Jeff

Dec 7 '05 #1
0 3134

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Timmah | last post: by
7 posts views Thread by C Gillespie | last post: by
1 post views Thread by googlemike | last post: by
4 posts views Thread by Shawn Mehaffie | last post: by
2 posts views Thread by kevin | last post: by
3 posts views Thread by Sinan Nalkaya | last post: by
4 posts views Thread by Brendan Miller | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.