Compartir a través de


Adding Property Pages: Implementation Details

The procedures in this section assume that you want to create and add property pages to property sheets that are owned by MMC.

To add a property page

  1. Determine whether you want to implement the property page for a scope item or for a result item. Then, depending on your choice, ensure that the snap-in's IComponentData or correct IComponent implementation implements the IExtendPropertySheet2 interface.

  2. Implement the IExtendPropertySheet2::CreatePropertyPages method in the appropriate IComponentData or IComponent implementation 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.
  3. 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.

  4. 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 implementation of the IExtendPropertySheet2::CreatePropertyPages method.

  5. Use the IConsoleVerb::SetVerbState method to enable the MMC_VERB_PROPERTIES enumerator value of the MMC_CONSOLE_VERB enumeration. The snap-in should call SetVerbState in the handler for the MMCN_SELECT notification sent to the corresponding IComponentData or IComponent object. This notification is sent to the snap-in when the user selects the scope item or result item for which you are implementing the property page.

  6. The snap-in should call the MMCPropertyChangeNotify function if the user can change any page properties. As a result of this method call, an MMCN_PROPERTY_CHANGE notification is sent to the corresponding IComponentData or IComponent object. The snap-in should be prepared to handle this notification.

Adding Property Pages: Interfaces