如何执行“shell” Visual Studio 2010中嵌入图标? [英] How to perform "shell" icon embedding in Visual Studio 2010?

查看:145
本文介绍了如何执行“shell” Visual Studio 2010中嵌入图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,有(至少?)三种类型的图标嵌入。 shell32.dll和朋友使用的原始样式,.NET的嵌入以及WPF使用的新类型。我正在寻找如何执行第一个,因为我想有一些其他图标可用作跳转列表的资源,只能接受该样式。但是,我无法弄清楚如何嵌入这种风格,只有其他两种。

As far as I can tell, there have been (at least?) three types of icon embedding. There's the original style used by shell32.dll and friends, .NET's embedding, and the new type that WPF uses. I'm looking for how to perform the first one, as I want to have a few other icons available as resources for a jumplist, which can only accept that style. However, I can't figure out how to embed in this style, only the other two.

我该怎么做?我在google等上找到的所有结果都是为ResX文件或类似文件添加图标。

How do I do this? All the results I find on google, etc are for adding icons to ResX files or similar.

推荐答案

我从未听过图标嵌入之前。如果您正在讨论在资源管理器或桌面快捷方式中对EXE或DLL可见的图标:对于任何Windows程序,这都是相同的。 WF和WPF都使用/ win32res编译选项为程序集提供具有所选图标的非托管资源。您可以在Visual Studio中使用File + Open + File查看它,选择EXE或DLL。

I never heard the term "icon embedding" before. If you are talking about the icon that's visible for a EXE or DLL in Explorer or a desktop shortcut: that's done the same way for any Windows program. Both WF and WPF give the assembly an unmanaged resource with the selected icon using the /win32res compile option. You can see it in Visual Studio with File + Open + File, select the EXE or DLL.

要创建.res文件,首先要创建一个.rc文件。您可以使用C ++ IDE创建一个。右键单击解决方案,添加新项目,Visual C ++,Win32,Win32控制台应用程序。右键单击资源文件文件夹,添加+资源,选择图标,导入。选择你的文件。根据需要重复。构建之后,您将在项目的Debug构建目录中获得.res文件。

To create a .res file, first create a .rc file. You can create one with the C++ IDE. Right-click the solution, Add New Project, Visual C++, Win32, Win32 Console Application. Right-click the Resource Files folder, Add + Resource, select Icon, Import. select your file. Repeat as needed. After you build, you'll get a .res file in the project's Debug build directory.

返回到C#项目,Project + Properties,Application选项卡。选择Resource File选项并导航到.res文件。

Back to your C# project, Project + Properties, Application tab. Select the Resource File option and navigate to the .res file.

这篇关于如何执行“shell” Visual Studio 2010中嵌入图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆