自定义 mmc 管理单元图标

发布于 2024-08-15 14:13:56 字数 45 浏览 3 评论 0原文

研究如何为我的自定义 mmc 管理单元提供图标。

语言=c#

Looking into how to provide the icon for my custom mmc snap-ins.

Language = c#

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

护你周全 2024-08-22 14:13:56

如果您想要在 MMC 的“添加/删除”对话框中提供 DLL 的位图,您需要指定 SnapInAbout 属性,并提供资源 DLL 和位图 id。

啊?

更多完整答案在这里

MMC SDK 示例中也有工作代码。

If what you want is to provide the bitmaps for your DLL in the Add/Remove dialog in MMC, You need to specify the SnapInAbout attribute, and provide a Resource DLL, and an id for the bitmap.

Huh?

More complete answer here.

And also in the MMC SDK sample, there's working code.

撞了怀 2024-08-22 14:13:56

您无法在 C# 中执行此操作。您必须创建一个本机 Win32 dll。换句话说:创建一个 C++ 项目。这并没有那么可怕。

添加 Win32 项目 Visual C++ 后,可以使用向导添加资源文件。
从那里您可以使用工具添加图标和文本描述。

如果一切顺利,您将在“头文件”文件夹中生成一个resource.h 文件。打开该文件,您将看到类似

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ConsoleResources.rc
//
#define IDB_BITMAP4                     101
#define IDB_BITMAP5                     102
#define IDI_ICON2                       103
#define IDS_COMPANY                     104
#define IDS_PRODUCT_NAME                105
#define IDS_DESCRIPTION                 106

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        107
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

这些数字 101,... 的数字,这些数字必须与您放入 C# 文件中的 SnapInAbout 属性相对应。

[SnapInAbout("Your.Unmanaged.dll", ApplicationBaseRelative = true, 
 VendorId = 104, DisplayNameId = 105, DescriptionId = 106, IconId = 103,
 SmallFolderBitmapId = 110, LargeFolderBitmapId = 102, 
 SmallFolderSelectedBitmapId = 101)]    

You cannot do this in C#. You have to create a native Win32 dll. In other words: create a C++ project. This is not that scary.

Once you add a Win32 Project Visual C++, you can use the wizard to add a resource file.
From there you can use the tools to add an icon, and the text descriptions.

If everything goes correct you will have a resource.h file generated in the folder "Header Files". Open that file, and you will see something like

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ConsoleResources.rc
//
#define IDB_BITMAP4                     101
#define IDB_BITMAP5                     102
#define IDI_ICON2                       103
#define IDS_COMPANY                     104
#define IDS_PRODUCT_NAME                105
#define IDS_DESCRIPTION                 106

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        107
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

These numbers 101,... are the numbers that have to correspond with the SnapInAbout attribute that you put in your C# file.

[SnapInAbout("Your.Unmanaged.dll", ApplicationBaseRelative = true, 
 VendorId = 104, DisplayNameId = 105, DescriptionId = 106, IconId = 103,
 SmallFolderBitmapId = 110, LargeFolderBitmapId = 102, 
 SmallFolderSelectedBitmapId = 101)]    
左秋 2024-08-22 14:13:56

我找到了办法。我必须将图像添加到 SnapIn 的 SmallImages 集合中。

然后每个scopenode都有一个ImageIndex和SelectedImageIndex。您所要做的就是将这些属性设置为 SmallImages 集合的正确索引。

I found a way. I had to add the images to the SmallImages collection of the SnapIn.

And then each scopenode has a ImageIndex and SelectedImageIndex. All you have is to set those property to the correct index of the SmallImages Collection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文