InitPropVariantFromStringAsVector function (propvarutil.h)

Initializes a PROPVARIANT structure from a specified string. The string is parsed as a semi-colon delimited list (for example: "A;B;C").

Syntax

PSSTDAPI InitPropVariantFromStringAsVector(
  [in]  PCWSTR      psz,
  [out] PROPVARIANT *ppropvar
);

Parameters

[in] psz

Type: PCWSTR

Pointer to a buffer that contains the source Unicode string.

[out] ppropvar

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

Creates a VT_VECTOR | VT_LPWSTR propvariant. It parses the source string as a semicolon list of values. The string "a; b; c" creates a vector with three values. Leading and trailing whitespace are removed, and empty values are omitted.

If psz is NULL or contains no values, the PROPVARIANT structure is initialized as VT_EMPTY.

Examples

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

PROPVARIANT propvar;
HRESULT hr = InitPropVariantFromStringAsVector(L"a; b; c", &propvar);

if (SUCCEEDED(hr))
{
    // propvar now has type VT_VECTOR | VT_LPWSTR and contains {"a", "b", "c"}.
    PropVariantClear(&propvar);
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header propvarutil.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0

See also

InitPropVariantFromString

InitPropVariantFromStringVector

InitVariantFromStringArray

PropVariantToStringVector