Rob Chartier ~ Contemplation...

.NET, C#, Work, etc.

News






www.flickr.com
This is a Flickr badge showing public photos from Rob & Kat Chartier. Make your own badge here.


Even Quicker Links

.NET Screen Saver

The .NET Screen Saver just came down into SharpReader via the GotDotNet Samples Feed so I decided to check it out.  Played around with it, adding a few Perf Counters on it (CPU, Active ASP.NET Sessions, Random Quote, etc..) and installed it.

Everything worked fine, excpet for my App.config.

With screen savers all you need to do is rename the .exe file to a .scr file and then copy it into the WINNT folder.  Well by renaming it from  ScreenSaver.exe to ScreenSaver.scr you would think all I would need to do is rename the ScreenSaver.exe.config to ScreenSaver.scr.config and all would be fine. 

Nope.

It doesnt pick up these settings.  Does this automatic App Settings import only happen on .exe files?  Is there some way I can add this ability to the Screen Saver (Win Form) so that it knows about the .scr.config file?  I would hate to have to do the XML Parsing/DeSerialization my self.  (Shouldnt it “Just work“?)

 

Comments

tracker1 said:

Have you tried compiling the file into "appname.scr" instead of "appname.exe" from the command line compiler? if not using the ccr, not sure...

Alternatively, could you have a small stub for the .scr that runs the actual .exe .. or if you leave the name of the app.config as .exe.config, does it import the settings...

just a few thoughts.. came accross this via the www.idledreams.net blog .. going to be hosting the ansi archive site.. :)
# August 20, 2003 2:48 AM

Rob Chartier said:

Compiling directly to .scr doesnt work.

The stub would work, but loading up an EXE doesnt seem reasonable to me. I would rather parse the XML directly (using XML Serialization).

Leaving the name as app.config (app.scr and app.config) doesnt work either.



Thanks for the ideas.
# August 20, 2003 3:46 PM

Al Davis said:

Since the runtime locates configuration settings in 3 locations (app, policy, machine) you can choose the easiest out of the last 2 (publisher policy and machine) and add your configuration settings to the machine.config file instead.

After you get that working you can also deploy your configuration information to a resource file as well.

# August 21, 2003 8:57 PM

AMurthy said:

Here is a way that works for me.

1) Rename your Screensaver.exe to Screensave.scr

2) DONT rename the Screensaver.exe.cnfig file.

3) Right click on "Screensaver.scr" and select "Install" from the context menu.

This will automatically move the .scr into the "winnt/windows" folder and also propagate the .config file.

Your "Screensaver" will now show up in the drop-down list of screen savers.

# January 5, 2008 12:39 PM