none
How to change a (C# winform) Screen Saver's Title (friendly name) in Display Properties? RRS feed

  • Question

  • Hi there,

    I have a farely simple question that I can't seem to find the answer
    to.

    I've got a C# Winforms application that after building results in an
    executable. This executable is then renamed to an .scr file and used as
    a Screen Saver.

    How can I get this file to come up with a different name than the
    filename in the dropdown list in Display Properties/Screen Saver? My
    screensaver's filename is "screensaver.scr" and the dropdown shows
    "screensaver", instead of a more friendly name "My Beautiful Screen
    Saver".

    I've searched everywhere but all I get is things that refer to a
    StringTable, where you have to add a row with ID 1 and name "title" and
    value "screensaver title". This should result in a different Title
    being used in the dropdown mentioned before. However, I don't know how
    to add this StringTable to my C# project.
    When I open existing .scr files (that come with windows) in VS.Net
    using the Resource Editor I see a StringTable that indeed contains this
    ID 1 row, but when I open my own executable, I don't even have a
    StringTable.

    I hope someone can advise me on what to do.

    Thanks in advance,

    Mark

    Monday, January 22, 2007 12:07 PM

Answers

  • You need to add a string to the native Win32 resources of the assembly.  That's trivial in the C++ IDE but pretty hard to in the C# IDE.   This thread suggests it can be done, tell us about it if you can figure out how to follow the instructions.
    Monday, January 22, 2007 1:40 PM
    Moderator

All replies

  • You need to add a string to the native Win32 resources of the assembly.  That's trivial in the C++ IDE but pretty hard to in the C# IDE.   This thread suggests it can be done, tell us about it if you can figure out how to follow the instructions.
    Monday, January 22, 2007 1:40 PM
    Moderator
  • Thank you very much for that link. Following those instructions (but instead of adding a Version resource, I added a StringTable resource) did the job!

    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: <empty>, 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.

    Wednesday, January 24, 2007 10:36 AM
  • Thanks for posting back!  Step 1 gave me a headache.  Tools + Customize, Commands tab, scroll to "New File" and drag & drop it into the File menu.
    Wednesday, January 24, 2007 12:26 PM
    Moderator