开发者

custom mmc snap-ins icon

Looking into how to provide the icon for my custom mmc 开发者_Go百科snap-ins.

Language = c#


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.


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)]    


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜