4

I have a working screensaver and would like to figure out how I can control the name Windows displays in the screensaver drop down list. Currently it all seems to be based on the filename but I know that can't be the case. Here's what I've tried and the results:

Filename: CC.Votd.scr ScreenSaver Name: Cc

Filename: CC Votd.scr ScreenSaver Name: Cc Votd

I'd like to have the file be named CC.Votd.scr and have the screensaver name display as CC.Votd (capitalization is important to me so even CC Votd would be ok :-))

I'm pretty sure this is possible because the Photos screensaver is PhotoScreensaver.scr

Thanks in advance for your help.

Cory Charlton
  • 8,868
  • 4
  • 48
  • 68

2 Answers2

3

This thread has the answer:

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/35ea8aeb-e729-474c-b6d2-544fc3c48d8d

I figured out I needed that String Table, I just didn't know how to add that native resource to my assembly. To add this String Table, I had to convert my VS2003 solution to a VS2005 solution, because VS2003 doesn't allow to add native resources to your project. Below you'll find a modified (by me) copy of what you pointed me to. How to add a nice looking title to your screen saver (The one that comes up in the dropdown list on the Screen Saver tab in Display Properties) original source: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=77460&SiteID=1 modified steps:
1. In Visual Studio, choose File -> New -> File
2. Under the General node, select Native Resource Template and click Open
3. In the Designer window, right-click the ResTempl1.rct node and click Add Resource
4. In the Add Resource dialog, select String Table and click New
5. Modify the first record so it has the following values: ID: , Value: 1, Caption: My Screen Saver Title
6. Choose File -> Save As, change Save as type to 32-bit Resource File and save the file to a location that you will remember
7. In Solution Explorer, right-click the Project node you want to change the Product Version of and click Properties
8. In the Application tab, check Resource File and click ...
9. Browse to the native resource file you created above and click OK
10. Rebuild your project

Your assembly should now reflect the values contained in the resource file. Note: If you had an Icon in your application, you'll now have to add this manually to the native resource file. This is because the Project Properties allow you to either choose "Icon" or "Resource File", not both. So to add an Icon to your application, add it to the just created native Resource File, just like you added the String Table.

Malfist
  • 31,179
  • 61
  • 182
  • 269
Adam Ruth
  • 3,575
  • 1
  • 21
  • 20
3

The screensaver name is pulled from native resources of the .scr file. so you would need to add an unmanaged resource. and use string ID 1 for the name.

The .rc file would look like this

STRINGTABLE
BEGIN
   1 "My Screensaver"
END
John Knoeller
  • 33,512
  • 4
  • 61
  • 92
  • I just read the link posted by other answer, and noticed the steps were all assuming an IDE. So I'm glad to see it isn't totally impossible to do by hand. But how does the project know to use the resource as the title? Is that the only possible thing String Tables can be used for? – Anthony Feb 08 '10 at 00:48
  • The project has absolutely no idea that it needs to be used as the title - in fact, it doesn't even know what the "title" is. All it knows is "hey, this guy wants a native resource embedded in the application". The screensaver dialogue then pulls out the first string resource and uses that as the "title" of the screensaver. – Anon. Feb 08 '10 at 00:50
  • I don't think it's the project that is using it so much as the screen saver dialog is looking in the executable, for a string table that contains a row with no id and the value of 1. – Cory Charlton Feb 08 '10 at 00:50
  • Yes, the dialog is making the assumption that string id 1 (or possibly the first string) is the title. It's a pretty brain-damaged design, but .scr files go back all the way to windows 3.x so what can you do? – John Knoeller Feb 08 '10 at 00:54
  • +1 for the great info. That was much less painful than I expected. Even adding my pretty icon back was a breeze :-) – Cory Charlton Feb 08 '10 at 00:58
  • @Cory: I've always felt it's easier to edit the .rc file with a text editor than to use the IDE - It annoys the heck out of me that double clicking on .rc files causes the IDE to _compile_ them rather than just opening up the text file – John Knoeller Feb 08 '10 at 01:02
  • @Anthony: No stringtables are used for many things, the dialog is apparently just _assuming_ that the first string is the title, just like Windows assumes that it should use the first Icon as your application icon. it's the way things were done back in the Win3x days. – John Knoeller Feb 08 '10 at 01:50