简体   繁体   English

如何控制下拉列表中显示的屏幕保护程序名称?

[英]How do I control the screensaver name shown in the drop down list?

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. 我有一个工作的屏幕保护程序,想知道如何控制Windows在屏幕保护程序下拉列表中显示的名称。 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 文件名: CC.Votd.scr ScreenSaver名称: Cc

Filename: CC Votd.scr ScreenSaver Name: Cc Votd 文件名: CC Votd.scr ScreenSaver名称: 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 :-)) 我想将文件命名为CC.Votd.scr并将屏幕保护程序名称显示为CC.Votd (大写对我来说很重要,所以即使CC Votd也可以:-))

I'm pretty sure this is possible because the Photos screensaver is PhotoScreensaver.scr 我很确定这是可能的,因为Photos屏幕保护程序是PhotoScreensaver.scr

Thanks in advance for your help. 在此先感谢您的帮助。

This thread has the answer: 这个帖子有答案:

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/35ea8aeb-e729-474c-b6d2-544fc3c48d8d 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. 我发现我需要String Table,我只是不知道如何将该原生资源添加到我的程序集中。 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. 要添加此字符串表,我必须将我的VS2003解决方案转换为VS2005解决方案,因为VS2003不允许向项目添加本机资源。 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: 如何为屏幕保护程序添加漂亮的标题(显示属性中屏幕保护程序选项卡下拉列表中显示的标题)原始来源: http//forums.microsoft.com/MSDN/ShowPost.aspx?PostID = 77460&SiteID = 1个修改步骤:
1. In Visual Studio, choose File -> New -> File 1.在Visual Studio中,选择“文件” - >“新建” - >“文件”
2. Under the General node, select Native Resource Template and click Open 2.在“常规”节点下,选择“本机资源模板”并单击“打开”
3. In the Designer window, right-click the ResTempl1.rct node and click Add Resource 3.在Designer窗口中,右键单击ResTempl1.rct节点,然后单击“添加资源”
4. In the Add Resource dialog, select String Table and click New 4.在Add Resource对话框中,选择String Table并单击New
5. Modify the first record so it has the following values: ID: , Value: 1, Caption: My Screen Saver Title 5.修改第一条记录,使其具有以下值:ID:,值:1,标题:我的屏幕保护程序标题
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 6.选择“文件” - >“另存为”,将“保存类型”更改为32位资源文件,然后将文件保存到您将记住的位置
7. In Solution Explorer, right-click the Project node you want to change the Product Version of and click Properties 7.在“解决方案资源管理器”中,右键单击要更改“产品版本”的“项目”节点,然后单击“属性”
8. In the Application tab, check Resource File and click ... 8.在Application选项卡中,选中Resource File并单击...
9. Browse to the native resource file you created above and click OK 9.浏览到上面创建的本机资源文件,然后单击“确定”
10. Rebuild your project 10.重建您的项目

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. 注意:如果应用程序中有一个Icon,则现在必须手动将其添加到本机资源文件中。 This is because the Project Properties allow you to either choose "Icon" or "Resource File", not both. 这是因为Project Properties允许您选择“Icon”或“Resource File”,而不是两者。 So to add an Icon to your application, add it to the just created native Resource File, just like you added the String Table. 因此,要向应用程序添加一个Icon,请将其添加到刚刚创建的本机资源文件中,就像添加了String Table一样。

The screensaver name is pulled from native resources of the .scr file. 屏幕保护程序名称是从.scr文件的本机资源中提取的。 so you would need to add an unmanaged resource. 所以你需要添加一个非托管资源。 and use string ID 1 for the name. 并使用字符串ID 1作为名称。

The .rc file would look like this .rc文件看起来像这样

STRINGTABLE
BEGIN
   1 "My Screensaver"
END

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM