次の方法で共有


Extending the Property Sheet of a Primary Snap-in

This section discusses the specific Steps necessary for an extension snap-in to extend the property sheet of an extendable node type owned by a primary snap-in. For more information about working with extension snap-ins, see Working with Extension Snap-ins.

A primary snap-in registers the extendable node types that it adds to its namespace. An extension snap-in can extend the property sheet of a primary snap-in's node type by adding the appropriate registration code and then implementing the IExtendPropertySheet2 interface.

Primary snap-ins that add node types that can be extended by property page extensions must enable the MMC_VERB_PROPERTIES verb for the extendable items. For more information about enabling standard verbs, see Enabling MMC Standard Verbs. Primary snap-ins that do not add property pages of their own must still implement IExtendPropertySheet2 and return S_OK in their implementation of the IExtendPropertySheet2 methods.

A primary snap-in that uses IPropertySheetProvider to display a property sheet must explicitly enable extension snap-ins to add extension pages by calling IPropertySheetProvider::AddExtensionPages.

In the following procedure, be aware that {CLSID}, {snapinCLSID}, and {nodetypeGUID} all denote string representations of the specified CLSIDs and GUIDs. The strings must begin with an open brace ({) and end with a close brace (}).

To extend a primary snap-in property sheet

  1. The CLSID of each snap-in (extension or stand-alone) must be registered under the HKEY_CLASSES_ROOT\CLSID key in the {CLSID} subkey as an in-process server DLL. The snap-in must also register a threading model for the snap-in CLSID. An apartment threading model is recommended.

    For more information about the HKEY_CLASSES_ROOT\CLSID key, see the CLSID Key . For more information and a code example, see Registering and Unregistering a Snap-in.

  2. All snap-ins must be registered under the HKEY_LOCAL_MACHINE\Software\Microsoft\MMC\SnapIns key in the {snapinCLSID} key. For more information about the SnapIns key, see Registering and Unregistering a Snap-in.

  3. Register the CLSID of the extension snap-in under the HKEY_LOCAL_MACHINE\Software\Microsoft\MMC\NodeTypes\{nodetypeGUID}\Extensions\PropertySheet subkey, where nodetypeGUID is the node type GUID of the node type whose property sheet is extended. For more information about the NodeTypes key, see Registration Requirements for Extension Snap-ins.

  4. Implement the IExtendPropertySheet2::CreatePropertyPages method to add property pages.

    In the implementation of CreatePropertyPages:

    • Define one or more property pages by filling the PROPSHEETPAGE structure for each of the property pages with information about the page. Be aware that the standard size for a property page in an MMC console is 252 dialog units horizontally and 218 dialog units vertically.
    • For each PROPSHEETPAGE structure, call the API function CreatePropertySheetPage to create a property sheet page. The function returns a handle to the HPROPSHEETPAGE type that uniquely identifies the page.
    • Using the pointer to the IPropertySheetCallback interface passed to the snap-in in the call to the CreatePropertyPages method, call the IPropertySheetCallback::AddPage method to add each property page to the MMC-provided property sheet.
  5. Implement a dialog box procedure for each property page. The pfnDlgProc member of each property page's PROPSHEETPAGE structure should be set to the address of this procedure.

  6. Implement the IExtendPropertySheet2::QueryPagesFor method. MMC calls this method when the user selects a scope or result item and clicks the Properties context menu item. If this method returns S_OK, MMC then calls the snap-in's implementation of the IExtendPropertySheet2::CreatePropertyPages method.

Adding Property Pages and Wizard Pages

Working with Extension Snap-ins