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

查看:23
本文介绍了如何执行“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.

我该怎么做?我在谷歌等上找到的所有结果都是为 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 控制台应用程序.右键单击 Resource Files 文件夹,添加 + 资源,选择图标,导入.选择您的文件.根据需要重复.构建完成后,您将在项目的 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# 项目,项目 + 属性,应用程序选项卡.选择资源文件"选项并导航到 .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天全站免登陆