MMC编程元件.doc_第1页
MMC编程元件.doc_第2页
MMC编程元件.doc_第3页
MMC编程元件.doc_第4页
MMC编程元件.doc_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

MMC Programming ElementsMMC编程元件It is useful to be familiar with the programming elements offered by MMC before you undertake the task of designing a snap-in. The purpose of the MMC 3.0 SDK is to design snap-ins. The snap-in contains the actual workings of a management task. It is designed to run within the context of the MMC. The MMC 3.0 SDK facilitates the design of a snap-in to encapsulate either a specific management task or a set of operations. It allows the snap-in development to focus on the objects to be managed and the methods used to manage the objects. A snap-in can either be a stand-alone snap-in, thereby providing independent programmatic functionality, or it can be an extension snap-in that extends the operations of a specific snap-in, and is dependent on the parent snap-in to operate. For example, a simple mail transfer protocol (SMTP) snap-in may be an extension snap-in that relies on the IIS snap-in. 当你要开发一个管理单元时,熟悉一下MMC提供的编程元件将会非常有用。MMC3.0 SDK的目的就是要开发管理单元。这个管理单元才具有实际的管理功能,它运行在MMC环境中。MMC 3.0 SDK 便利了管理单元的设计,这个管理单元封装了一个特定的任务或者一组操作。MMC 3.0 SDK 允许管理单元的开发关注于所管理的对象和管理这些对象所用的方法。管理单元可以是单一的,从而提供独立的编程功能;也可以是一个依赖父管理单元的扩展的管理单元。例如,一个简单的邮件传送协议管理单元可以是一个依赖于IIS管理单元的扩展单元。The following are useful decision steps to consider before starting:下面是开始之前需要考虑的一些关键步骤:1. Identify the management space and determine what type of snap-in best suits your needs. Decide whether your management tasks should existas part of a stand-alone snap-in, be put into an extension snap-in, or reflect a combination of both. A stand-alone snap-in is capable of performing its designated management task as the only snap-in loaded in the snap-in console. When loaded in a snap-in console that contains multiple snap-ins, a stand-alone snap-in appears as a child of the MMC root node and operates independently from any of the other stand-alone snap-ins in the snap-in console. In contrast, an extension snap-in adds functionality to a stand-alone snap-in. The additional functionality can be represented using additional child nodes under an existing stand-alone snap-in node in the tree. 确定管理空间并决定最合适的能满足需要的管理单元类型。决定你的管理任务是以独立的管理单元存在,还是把它放进一个扩展的管理单元里,或者是两者结合起来。独立管理单元可以作为控制台唯一的管理单元执行指定的管理任务。当被装载进管理单元控制台后,这个独立的管理单元会以MMC根节点的子节点的形式出现在控制台中,并且以独立于控制台中其它独立管理单元的方式运行。相反,扩展管理单元扩展了独立管理单元的功能。这些附加功能会以已经存在的独立管理单元的节点的子节点的形式出现在树形目录里,2. Layout the namespace, and decide what objects or containers belong in it. The organization of the scope tree is critical to the success and usability of your snap-in. While mapping the management space to the scope tree, it is important to understand the node types, understand how to organize the tree based on user tasks and roles, and know how to summarize data and user inheritance models. 设计命名空间,并决定其中的对象和容器。范围树的配置对管理单元的可用性和成功至关重要。理解节点类型、解根据用户任务和角色组织树、知道如何汇总数据和用户继承模型,在将管理空间映射到范围树时是重要的。3. Design the UI to present information about the managed objects. 设计用户接口显示管理的对象。4. Define the management tasks for each object in the namespace.明确空间中每个对象的管理任务5. Start writing the snap-in code using the MMC 3.0 Managed Code Framework.开始用MMC3.0 代码管理框架编写代码。As a snap-in designer, it is useful to separate the core management functionality from the presentation. It is useful to think of the programming elements that are offered by MMC and associate management tasks with their functionality. After this is done, it is easier to map the desired UI to the UI that MMC offers in association with each of these elements. For example, the UI for the tree pane is relatively static (a tree) while the UI for the results pane is more flexible. Accordingly, it is useful to identify the static nodes in the management space and map them to scope nodes. It is possible to choose any of the supported view types in MMC for each scope node. A good snap-in design should be able to provide the management logic and data and rely on MMC to provide the infrastructure to design the UI to offer the related views.The MMC namespace represents the hierarchy of objects and containers that are displayed in the console window.作为管理元件的设计人员,将核心的管理功能和显示功能分开是有用的。考虑MMC提供的编程元件并且将他们的功能和管理任务联系起来是有用的。 完成这些之后,将期望的用户接口映射到MMC提供的用户接口就变得更容易。例如,树形面板的用户接口相对固定,而结果面板则更灵活。因此,确定管理空间中的静态节点,并把它们映射到范围节点是有用的。在MMC中,可以为每个范围节点选择任何支持的视图类型。好的管理单元设计可以提供管理逻辑和数据并且可以依赖MMC来提供设计用户接口的基本结构。MMC命名空间描绘了控制台窗口中对象和容器的层次结构。In this Topic目录Snap-inUse of Attributes Programming ModelScope NodeResult NodeActionsStandard VerbsViews and View DescriptionsUsing Selection DataUtility ProgramsProperty Sheets and PagesWizardsDialogsLocalizationThreadingChecklist for Snap-in Design and DevelopmentSnap-inThe SnapIn class provides the abstraction for the core binding of a snap-in dynamic-link library (DLL) and provides the initial instantiation point of the snap-in code. To show the snap-in in the tree pane, the RootNode property of the snap-in must be set to a scope node. A snap-in can be either a stand-alone snap-in or an extension snap-in. 那个 管理单元 类提供了对于连接管理单元动态链接库(DLL)的核心的抽象概念,并提供了初步的管理实例点代码。为了将管理单元显示在树窗格中, 管理单元的根节点属性必须设置一个Scope Node。一个管理单元可以是一个独立的管理单元或扩展单元。 Use of Attributes Programming Model编程模型属性的使用MMC uses attributes to store essential metadata. Attributes accept two types of parameters: positional parameters and named parameters. Positional parameters are like constructor arguments and their signature matches one of the constructors of the corresponding attribute class. Named parameters are defined as non-static properties in the attribute class declaration. They are optional and, when used, their names should exactly match the name of the property that is defined in the attribute class declaration.MMC中使用属性来存储重要数据。属性接受两种类型的参数:位置参数和命名参数。位置参数的构造函数参数就像他们签名匹配的相应属性类的构造之一。在属性类声明中,命名参数定义为非静态属性。它们是可选的,在使用时,他们的名字应该与在属性类中定义的属性名称完全匹配。MMC uses both positional parameters and named parameters. For example, the SnapInSettingsAttribute is used to provide a GUID, a display name, and a description for the snap-in. For MMC to recognize that a snap-in is available on the system, that snap-in must be registered. Snap-in registration data consists of a set of registry keys and values that describe how and when to load the snap-in.MMC中同时使用位置参数和命名参数。例如, SnapInSettingsAttribute 用于提供一个GUID,显示名称,以及对于管理单元的描述。对于MMC中认识到,一个管理单元在系统中是可用的,并且管理单元必须被注册。管理单元的注册数据,包括介绍如何以及何时加载单元中的注册表项和值。Attributes allow a snap-in to be registered with minimal additional code requirements on the part of the snap-in developer. It uses reflection to examine the snap-ins and extract metadata. For more information about the use of attribute programming, see Providing Metadata Descriptions About Your Component. The following attributes are available: 属性允许管理单元按照最少额外代码的要求注册,这些要求属于管理单元开发的一部分。它使用反射来检查单元和提取元数据。如需更多有关属性编程使用的信息,请查看Providing Metadata Descriptions About Your Component。下面的属性是可用的:ExtendsNodeTypeAttributeThis is an optional attribute for a snap-in that specifies which node types it can extend. Multiple instances of this attribute may be applied to a single SnapIn class.这是一个管理单元可选的属性,具体指定了节点能够伸展到的节点类型。此属性的多个实例可用于单 管理单元 类。NodeTypeAttributeThis is an optional attribute that is used to define the registration information for a node. If a node does not have this attribute, it will not be registered as an extensible node. This attribute is applicable to a scope node. The value of this attribute contains the node type GUID of the scope node.这是一个可选属性,用来定义一个节点的注册信息。如果一个节点没有这个属性,它不会被注册为一个可扩展节点。此属性是适用于Scope Node。该属性的值包含Scope Node的节点类型GUID。PublishesNodeTypeAttributeThis is an optional attribute that is used to define the registration information for a node. If a node does not have this attribute, it will not be registered as an extensible node. This is an attribute applicable to a snap-in and its value contains the node type GUID for a scope node or selected items in a view that can be extended. More than one PublishesNodeTypeAttribute are applicable to a snap-in.这是一个可选属性,用来定义一个节点的注册信息。如果一个节点没有这个属性,它不会被注册为一个可扩展节点。这是一个适用于管理单元的属性,其值包含对于Scope Node或在一个可扩展视图中选择的项目的节点类型GUID。不止一个 PublishesNodeTypeAttribute 适用于一单元。SnapInSettingsAttributeThis attribute is used to define the registration information for a snap-in. A single instance may be applied to a class that is derived from a snap-in. Both primary and extension snap-ins have the following registry keys and values associated with them. Some entries are optional and may or may not exist for a given snap-in. InstallUtil.exe will populate the registry entries for a given snap-in under HKLM/Software/Microsoft/MMC/SnapIns, as listed in the following table.此属性用于定义一个单元注册信息单元。单一实例可能被应用到从一个单元派生的类。初始和扩展管理单元具有以下注册表项和与他们关联的值。有些项目是可选的,可能存在也可能不存在于一个给定的管理单元。 InstallUtil.exe将填充一个给定的单元中的注册表项,该注册表项在HKLM/Software/Microsoft/MMC/SnapIns下,如下表所列。Path 路径Description 描述FX:GUIDRequired. This key contains the root entry for snap-in registry information. FX is a prefix that is used to distinguish MMC 3.0 snap-ins from the older snap-ins. 必需的。这个包含了单元根目录的注册信息。FX是用来区分旧式MMC3.0管理单元的前缀。FX:GUID/NamestringOptional. This REG_SZ value specifies the un-localized name of the snap-in. In the absence of a localized name, this value is used in the Add/Remove Snap-in dialog box.可选。这个REG_SZ值指定了单元的未本地化的名称。在缺乏本地化名称的情况下,该值用于添加/删除管理单元对话框。FX:GUID/Description 说明Optional. This REG_SZ value specifies the un-localized description of the snap-in. In the absence of a localized description, this value is used in the Add/Remove Snap-in dialog box.可选。这个值指定了管理单元的未本地化的描述。在缺少局部描述的情况下,该值用于添加/删除管理单元对话框。FX:GUID/Version 版本Optional. This REG_SZ value specifies the un-localized version of the snap-in. In the absence of a localized version, this value is used in the Add/Remove Snap-in dialog box.可选。这个值指定了单元的未本地化版本。在缺少本地化版本的情况下,该值用于添加/删除管理单元对话框。FX:GUID/Provider 供应商Optional. This REG_SZ value specifies the un-localized vendor name of the snap-in. If a localized version of the provider does not exist, this value is used in the Add/Remove Snap-in dialog box.可选。这个值指定了单元的未本地化供应商名称,如果提供者的本地化版本不存在的话,该值用于添加/删除管理单元对话框。FX:GUID/ApplicationBase Required. This REG_SZ value specifies the base directory for the assembly that contains the snap-in. Configuration files and other files that are associated with the snap-in are referenced in relation to this path.必需的。这REG_SZ值指定了程序集的包含管理单元的基目录。配置文件和与管理单元有关的其他文件就通过此路径被引用。FX:GUID/ModuleName 模块名Required. This REG_SZ value specifies the name of the module that contains the snap-in. 必需的。这个REG_SZ值指定了包含管理单元的模块名。FX:GUID/About 关于Required. This REG_SZ value specifies the CLSID for the COM object that implements ISnapInAbout interface. This value is not used for managed snap-ins, so it is always initialized to all zeros. 必需的。这REG_SZ值指定为COM对象的CLSID,这个对象实现ISnapInAbout接口。此值不能用于管理的管理单元,因此它总是初始化为全零。FX:GUID/RuntimeVersionRequired. This REG_SZ value specifies the version of the common language runtime (CLR) that the snap-in was built against.必需的。这REG_SZ值指定建成管理单元的公共语言运行库(CLR)的的版本。FX:GUID/ConfigurationFile 配置文件Optional. This REG_SZ value specifies the configuration file to use for the snap-in. If this value is not present, a default configuration file in the form of .dll.config is used.可选。这REG_SZ值指定了为管理单元所使用的配置文件。如果此值不存在,将会使用以.dll.config形式存在的默认的配置文件。 FX:GUID/LicenseFileOptional. This REG_SZ value specifies the license file to use for the snap-in. 可选。这REG_SZ值指定管理单元使用的许可证文件。FX:GUID/StandaloneThis is a key that is required if the snap-in is a primary snap-in. This key notifies MMC that the snap-in is a stand-alone snap-in, as opposed to an extension.如果管理单元是一个主单元,这是一个关键。这个键会告知MMC这个管理单元是一个独立的单元,而不是扩展的。FX:GUID/Extension扩展This is a key that is required if the snap-in is a snap-in extension. This key notifies MMC that the snap-in is an extension snap-in. The default value is one of: Namespace, PropertySheet.如果这个单元是扩展管理单元,这是一个关键。这个键会通知MMC这个管理单元是一个扩展管理单元。默认值为1的:命名空间,属性对话框。FX:GUID/NodeTypes 节点类型Optional. This key has sub keys that represent nodes that are published by the snap-in. This key might not be present if no nodes are published.可选。该键有子键,这些子键代表由管理单元提供的节点。如果没有公布的节点,该键可能不存在。FX:GUID/NodeTypes/GUIDOptional. This key specifies a node type (in the form of a GUID) that is published by the snap-in. There may be 0 or more GUID keys under this key. 可选。此项指定一个节点类型(以一个GUID形式),它是由管理单元公布的。在这个键下可能有0个或更多的(GUID)键。SnapInAboutAttributeSnap-ins may choose to provide localized SnapInAboutAttribute information instead of, or in addition to, providing un-localized strings. This information is used in the Add/Remove Snap-In dialog in core MMC. If a snap-in has a SnapInAboutAttribute applied to it, the following registry keys and values may exist. Each entry that refers to an indirect resource uses the format “path,-”, where path is the path to the module, is the module file name, and is the native resource Id within the module.管理单元可以选择提供本地化 SnapInAboutAttribute 信息,而不是提供未本地化的字符串。此信息用于MMC核心的添加/删除管理单元 对话框。如果一个单元应用了SnapInAboutAttribute,下面的注册表项和值可能存在。每个涉及到间接资源的条目使用格式“ 路径 , - 标识”,其中path是到模块路径,是模块的文件名,和是模块内的原生资源ID。InstallUtil.exe populates the SnapInAbout registry entries for a given snap-in under HKLM/Software/Microsoft/MMC/NodeTypes/FX:GUID.InstallUtil.exe填充一个给定单元的在HKLM/Software/Microsoft/MMC/NodeTypes/FX:GUID下的SnapInAbout注册表项。PathDescriptionModuleName 模块名称Required. This REG_SZ value specifies the module that contains the unmanaged resources for the SnapInAbout information.必需的。这REG_SZ值指定的模块,它包含SnapInAbout信息的非托管资源。DescriptionStringIndirectOptional. This REG_SZ value specifies the localized resource ID for the snap-in description. 可选。这REG_SZ值为单元描述指定本地化资源ID 。NamestringIndirectOptional. This REG_SZ value specifies the localized resource ID for the name of the snap-in.可选。这REG_SZ值为单元名称指定了本地化资源ID。ProviderStringIndirectOptional. This REG_SZ value specifies the localized resource ID for the snap-in provider.可选。这REG_SZ值为单元供应商指定了本地化资源ID。VersionStringIndirectOptional. This REG_SZ value specifies the localized resource ID for the snap-in version.可选。这REG_SZ值为单元的版本指定了本地化资源ID。IconIndirectOptional. This REG_SZ value specifies the localized resource ID for the description of the snap-in.可选。这REG_SZ值为管理单元的描述指定本地资源ID.LargeFolderBitmapIndirectOptional. This REG_SZ value specifies the localized resource ID for the large folder bitmap of the snap-in. The bitmap is 32x32 with 256 colors using the System palette.可选。这REG_SZ值为单元的大文件夹位图指定本地化资源ID。这个位图使用系统调色板,大小为32 x32,有256种颜色。SmallFolderBitmapIndirectOptional. This REG_SZ value specifies the localized resource ID for the small folder bitmap of the snap-in. The bitmap is 16x16 with 256 colors using the System palette.可选。这REG_SZ值为单元的小文件夹位图指定本地化资源ID。这个位图使用系统调色板,大小为16 x16,有256种颜色。SmallSelectedFolderBitmapIndirectOptional. This REG_SZ value specifies the localized resource ID for the small selected folder bitmap of the snap-in. The bitmap is 16x16 with 256 colors using the System palette.可选。这REG_SZ值为被选中的单元的小文件夹位图指定本地化资源ID。这个位图使用系统调色板,大小为16 x16,有256种颜色。SnapInLinkedHelpTopicAttributeThis optional attribute specifies a linked Help topic that is associated with a snap-in. At runtime, MMC uses the information in the attributes to find and load the referenced .chm files. You can also use the attribute to call the help topic for a scope node. You can also specify the help topic on the selection data and property page objects.这个可选属性指定一个链接的帮助主题,该主题与某个单元相关联的。在运行时,MMC使用的属性信息,查找和加载引用的.chm文件。您也可以使用属性调用Scope Node的帮助主题。您还可以指定选择的数据和属性页对象的帮助主题。SnapInHelpTopicAttributeThis optional attribute specifies the Help file and topic associated with a snap-in. An ApplicationBaseRelative property of this attribute indicates whether the Helppath is relative to the snap-in application base.这个可选属性指定与管理单元相关的主题和帮助文件。此属性的ApplicationBaseRelative属性指示帮助路径是否是以管理单元应用基础为基准的。RunInstaller AttributeSnapInInstaller is the base class for snap-in registration. It utilizes reflection to search for snap-ins that are defined within the currently loaded assembly. This metadata is then used to populate or remove register entries as appropriate for each snap-in. For each assembly in which a snap-in is defined and must be registered, a derivation of this class must exist with the RunInstaller attribute set to true. The derived class may be empty and may not override any of the virtual methods, or it may override them to provide additional registration functionality. The class that is derived from SnapInInstaller provides an entry point for tools such as InstallUtil.exe. SnapInInstaller 是单元注册的基类。它采用反射去搜寻单元,这些单元是当前加载的程序集定义的。此元数据用于为每个单元适当地填充或删除注册表项。对于每一个定义和注册管理单元的程序集,它的派生类的RunInstaller属性必须设置为true。派生类可能是空的,也可能没有重写任何虚拟方法,或者重写了,但是提供了额外的注册功能。从SnapInInstaller派生的类为例如InstallUtil.exe这样的工具提供了的切入点。Scope NodeThe ScopeNode class provides the basic icon and name for a node in the tree pane. Child nodes can also be added to a scope node and are shown indented underneath their parent node in the tree pane. Child nodes can also be added just-in-time by programming the OnExpand method that gets called when the plus sign next to the node is clicked. 那个 ScopeNode 类为在树窗格中的节点提供了基本图标和名称。子节点,可被添加到scope node,并且显示在父节点的下面。子节点,也可通过调用 OnExpand 方法被实时添加进来, 当旁边的加号节点被点击时,OnExpand方法就会被调用。 Multiple view descriptions can be added to a scope node to define more detailed views in the results pane when the scope node is selected. The default view for a scope node shows its children. 当某个scope node被选中时,多视图的描述可以被添加到scope node,来定义在结果窗格中显示的更详细的视图。对于一个范围节点的默认视图显示其孩子节点。The ScopeNode class inherits from the Node class, which provides functionality that is common to all node types. This includes actions, display text, node types, and changed events. The ScopeNode class adds specialization for nodes that represent items in the MMC scope namespace. The scope namespace is hierarchical, so scope nodes have Children. Each scope

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论