Freigeben über


MMC Code Directory

 

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

Here is a list of samples provided with the MMC 3.0 SDK.

Note

When the Windows SDK is installed, a Samples directory is created in which all the MMC 3.0 samples are made available. 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. Here, the MMC 3.0 samples directory is referred to as <MMC 3.0 Samples>.

CodeList

This table lists the code samples in the samples directory.

Sample Name

Path in Samples Directory

Purpose

Actions Sample

<MMC 3.0 Samples>\ActionsSample

Shows the various ways in which custom actions can be added to a snap-in. It is possible to add a custom action to a ScopeNode, View, MmcListViewMode, or a ResultNode selection.

Drag Drop Sample

<MMC 3.0 Samples>\DragDropSample

Shows how drag-and-drop controls work in a MmcListView. Loads a list of users into the list view and enables the standard verbs Copy and Paste. A node on which the drop is performed changes its DisplayName.

Extensible Snap-in Sample

<MMC 3.0 Samples>\ExtensibleSnapInSample

Shows how to create a primary snap-in that can be extended. Uses PublishesNodeTypeAttribute and NodeType attributes to create a snap-in that can be extended.

Extending Computer Management Sample

<MMC 3.0 Samples>\ExtendingComputerManagementSample

Shows how to extend the Computer Management snap-in. It uses the ExtendsNodeTypeAttribute attribute and the GUID of the primary snap-in root node to create a NamespaceExtension. It uses the shared data features to get the computer name from the primary snap-in and uses it in the extension node’s DisplayName as it adds it under System Tools.

Extension Sample

<MMC 3.0 Samples>\ExtensionToSapInSample

Shows how to create an extension to the Extensible Snap-in Sample. It uses the ExtendsNodeTypeAttribute attribute and the GUID of the Extensible Snap-in Sample root node to create a NamespaceExtension. It uses the shared data features to get data from the primary snap-in and uses it in the DisplayName of the extension node.

Extension to Property Sheet Sample

<MMC 3.0 Samples>\ExtensionToPropertySheetSample

Shows how to use the ExtendsNodeTypeAttribute and the GUID of the computer management snap-in root node to create an extension property sheet.

Help Sample

<MMC 3.0 Samples>\HelpSample

Shows how to add to the help system by pointing to a .chm file. It uses the SnapInHelpTopicAttribute attribute to cause an external .chm help file to be added to the MMC help system. It also shows how to assign a value to the HelpTopic property on the root node to jump right to a specific help page, in this case, the help page for the scope node definition.

Html View Sample

<MMC 3.0 Samples>\HtmlViewSample

Shows an example of HtmlView. It uses the HtmlView to show the site www.microsoft.com in the results pane.

Initialization Wizard Sample

<MMC 3.0 Samples>\InitializationWizardSample

Shows a wizard when a snap-in is added to the console. It uses the OnShowInitializationWizard method to show a dialog that allows the user to enter a name. The name is then used in setting the DisplayName of the root node.

Localized Snap-in Sample

<MMC 3.0 Samples>\LocalizedRegistrationSample

Shows how to localize the snap-in registration. It contains two projects. The first defines a new resource.dll. The second uses the SnapInAboutAttribute attribute to define resources in the external dll that are used to register the snap-in.

Message View Sample

<MMC 3.0 Samples>\MessageViewSample

Shows an example of a MessageView by showing a simple message in the results pane.

Modal Dialog Sample

<MMC 3.0 Samples>\ModalDialogSample

Shows a Connect To modal dialog. It uses the ShowDialog method to show a simple dialog during a Connect To action.

On Scope Node Change Sample

<MMC 3.0 Samples>\OnScopeNodeChangeSample

Shows how to recognize a change to scope node in a view. It creates a delegate for a changed event on the scope node. It can be used to handle status changes on the scope node.

Persistence Sample

<MMC 3.0 Samples>\PersistenceSample

Shows how to use MMC to load and store data for a snap-in. It uses the OnLoadCustomData and OnSaveCustomData methods to store and retrieve the DisplayName of the root node.

Property Sheet Sample

<MMC 3.0 Samples>\PropertySheetSample

Shows how to add property pages. It uses an MmcListView to load a list of Users. It adds a property page to the property sheet for the selected ResultNode.

Selection Form View Sample

<MMC 3.0 Samples>\SelectionFormViewSample

Shows an example of a FormView multi-selection. It uses a form view that contains a WinForm view. It adds Refresh and ShowSelected actions.

Selection List View Sample

<MMC 3.0 Samples>\SelectionListViewSample

Shows an example of an MmcListView with a multi-selection. It uses the list view to display list of users and adds Refresh and ShowSelection actions.

Services Manager Sample

<MMC 3.0 Samples>\ServiceManagerSample

Shows a complete example that incorporates several advanced features.

Simple Snap-in Sample

<MMC 3.0 Samples>\SimpleSnapInSample

Shows a minimal snap-in.

Standard Verbs Sample

<MMC 3.0 Samples>\StandardVerbsSample

Shows the use of verbs from the list defined in StandardVerbs.

Status Sample

<MMC 3.0 Samples>\StatusSample

Shows how to use status information to update the progress bar. It defines a new type of ScopeNode that adds children to itself every two seconds. While the children are being added, it updates the progress bar in MMC and displays the status bar message.

Threading Sample

<MMC 3.0 Samples>\ThreadingSample

Shows how use a separate thread to expand nodes and update the status and progress bar. It defines a new type of ScopeNode that adds children to itself. It spawns a new thread to perform the addition. The new thread uses Invoke method to create a delegate to add the nodes.

View Switching Sample

<MMC 3.0 Samples>\ViewSwitchingSample

Shows how a view can interact with its parent scope node to switch views. It defines a scope node and views. The default view can be swapped out for a sample error handling view, which can then be swapped back.