Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method asks the property bag to read the named property into a caller-initialized VARIANT.

Syntax

HRESULT Read( 
  LPCOLESTR 
pszPropName, 
  VARIANT* 
pVar, 
  IErrorlog* 
pErrorLog 
);

Parameters

pszPropName

[in] Address of the name of the property to read. This cannot be NULL.

pVar

[in, out] Address of the caller-initialized VARIANT that is to receive the property value on output.

The function must set both type and value members in the VARIANT before returning.

If the caller initialized the pVar->vtmember on entry, the property bag should attempt to change its corresponding value into this type.

If the caller sets pVar-> vtto VT_EMPTY, the property bag can use whatever type is convenient.

pErrorLog

[in, out] Address of the caller's error log in which the property bag stores any errors that occur during reads.

This can be NULL. If it is NULL, the caller does not receive errors.

Return Value

The following table shows the return values.

Value Description

S_OK

The property was read successfully. The caller becomes responsible for any allocations that are contained in the VARIANT in pVar.

E_POINTER

The address in pszPropNameis not valid, such as NULL.

E_INVALIDARG

The property named with pszPropNamedoes not exist in the property bag.

E_FAIL

The property bag was unable to read the specified property. For example, the caller specified a data type to which the property bag could not coerce the known value.

If the caller supplied an error log, a more descriptive error was sent there.

Remarks

The Readmethod asks the property bag to read the property named in pszPropNameinto the caller-initialized VARIANT in pVar.

Errors that occur are logged in the error log pointed to by pErrorLog. When pVar-> vtspecifies another object pointer, VT_UNKNOWN, the property bag is responsible for creating and initializing the object described by pszPropName.

E_NOTIMPL is not a valid return code because any object implementing this interface must support the entire functionality of the interface.

Requirements

Header ocidl.h, ocidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also