共用方式為


IPropertyBag2 interface

Provides an object with a property bag in which the object can save its properties persistently.

Members

The IPropertyBag2 interface inherits from the IUnknown interface. IPropertyBag2 also has these types of members:

  • Methods

Methods

The IPropertyBag2 interface has these methods.

Method Description
CountProperties

Gets the number of properties in the property bag.

GetPropertyInfo

Gets information for properties in a property bag without actually getting those properties.

LoadObject

Causes the property bag to instruct a property object that was previously created and initialized to read its persistent properties.

Read

Causes one or more properties to be read from the property bag.

Write

Causes one or more properties to be saved into the property bag.

 

Remarks

When a client wants to control how the individually named properties of an object are saved, it uses an object's IPersistPropertyBag2 interface as a persistence mechanism. The client supplies a property bag to the object in the form of an IPropertyBag2 interface.

IPropertyBag2 is an enhancement of the IPropertyBag interface. IPropertyBag2 allows the object to obtain type information for each property by using the CountProperties method and the GetPropertyInfo method. A property bag that implements IPropertyBag2 must also support IPropertyBag, so that objects that only support IPropertyBag can access their properties. Also, an object that supports IPropertyBag2 must also support IPropertyBag so that the object can communicate with property bags that only support IPropertyBag.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Ocidl.h

IDL

Ocidl.idl

See also

Reference

IPropertyBag

PROPBAG2

PROPBAG2_TYPE