次の方法で共有


How-To Develop Snap-ins Using MMC

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The primary objective of the MMC 3.0 SDK is to provide a quick snap-in implementation and to facilitate the continuous incremental improvement of the snap-in code when it has been built.

MMC 3.0 presents a significantly more simple model for snap-in development. As a snap-in developer, you must first decide what functionality the snap-in needs to provide, in terms of what management task it is intended to perform. Next, decide what programming elements are to be utilized in creating the snap-in. For example, there are four different view capabilities offered by MMC. Depending on the complexity of the snap-in, you can pick the view that best suits the level of richness in the views and balance it with the development effort. This section contains five basic samples that demonstrate the creation of snap-ins that have different features.

The first step often consists of designing a scope tree that serves as an abstraction of what the user visually sees as the scope of the management application. MMC 3.0 frees you, the snap-in developer, from the task of mapping user requests to core internal structures that may or may not correspond to a node concept. MMC 3.0 automatically provides the routing of messages, and the appropriate abstractions to hide the complexity that is inherent in the MMC COM interfaces that were a part of the programming model in MMC 2.0.

  1. How-To Create a Hello World Snap-in is a basic snap-in sample that shows the essential elements of a basic snap-in.

  2. How-To Create a Snap-in That Uses MMCListView is a snap-in that uses the node, class, and the basic MMC list view classes. It supplies the data that is used to populate the child nodes and the list view. It defines the actions that can be performed on selections and handles the selection events.

  3. How-To Create a Snap-in That Uses Property Pages is a snap-in that demonstrates the use of property pages. A snap-in can choose to associate a unique property page with each item or item type in a view. This snap-in utilizes an MMC supplied property sheet and populates it with a simple property page.

  4. How-To Create an Initialization Wizard is a snap-in that creates a wizard page that pops up when the snap-in gets added to the MMC console. It brings up a dialog box that allows the user to enter a name which is then used in setting the display name for the root node.

  5. How-To Create a Snap-in That Uses WinForm View demonstrates the use of a WinForm view to create a UI that is similar to the list view sample.

Note

When the Windows SDK is installed, a Samples directory is created in which all the MMC 3.0 samples are made available, including the ones mentioned in the above How-To topics. To locate the installation directory for the Windows SDK, click Start\All Programs\Microsoft Windows SDK\Cmd Shell. This opens a command shell showing the path of the Windows SDK installation directory. A typical value of the installation directory is C:\Program Files\Microsoft SDKs\Windows\v6.0. In the command shell, type "cd Samples\SysMgmt\MMC3.0" to locate the MMC 3.0 Samples directory. For the purpose of this documentation, the MMC 3.0 samples directory will be referred to as <MMC 3.0 Samples>.

Note   It is a best practice to run MMCPerf.exe when deploying a managed snap-in on an operating system prior to Windows Vista. The MMCPerf.exe tool, in the Windows System32 folder, can improve the performance of MMC and installed managed snap-ins. This tool is present in any operating system prior to Vista that has MMC 3.0 installed. However, this tool will only work if .NET 2.0 is installed. The managed snap-in developer should check their dependencies including .NET 2.0 and MMC 3.0 before running MMCPerf.exe. MMCPerf.exe will put the MMC assemblies in the GAC and NGEN them. 

See Also

Microsoft.ManagementConsole
Microsoft.ManagementConsole.Advanced
MMC Technology Summary