Expand Minimize

InitPropVariantVectorFromPropVariant function

Initializes a vector element in a PROPVARIANT structure with a value stored in another PROPVARIANT.

Syntax


HRESULT InitPropVariantVectorFromPropVariant(
  _In_   REFPROPVARIANT propvarSingle,
  _Out_  PROPVARIANT *ppropvarVector
);

Parameters

propvarSingle [in]

Type: REFPROPVARIANT

Reference to the source PROPVARIANT structure that contains a single value.

ppropvarVector [out]

Type: PROPVARIANT*

When this function returns, contains the initialized PROPVARIANT structure.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This function is used to convert a PROPVARIANT structure that contains a single value into a vector value.

For simple source types, this function initializes the PROPVARIANT as a vector of one element.

For a source that contains a string, this function initializes the PROPVARIANT with zero or more substrings taken from the source string, treating semicolons as delimiters. See InitPropVariantFromStringAsVector for more details.

The following input types are supported:

  • VT_I2
  • VT_UI2
  • VT_I4
  • VT_UI4
  • VT_I8
  • VT_UI8
  • VT_R8
  • VT_BOOL
  • VT_DATE
  • VT_FILETIME
  • VT_BSTR
  • VT_LPWSTR

Additional types may be supported in the future.

Examples

The following example, to be included as part of a larger program, demonstrates how to use InitPropVariantVectorFromPropVariant.


// PROPVARIANT propvarSource;
// Assume propvarSource is initialized and valid.

if (PropVariantGetElementCount(propvarSource) == 1)
{
    PROPVARIANT propvar;

    HRESULT hr = InitPropVariantVectorFromPropVariant(propvarSource, &propvar);

    if (SUCCEEDED(hr))
    {
       // propvar now is valid and is either VT_EMPTY or contains a vector.
       PropVariantClear(&propvar);
    }

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propvarutil.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

InitPropVariantFromStringAsVector
PropVariantGetElem
PropVariantGetElementCount

 

 

Community Additions

ADD
Show:
© 2014 Microsoft