Export (0) Print
Expand All
Expand Minimize

InitPropVariantFromStringAsVector function

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

Syntax


HRESULT InitPropVariantFromStringAsVector(
  _In_   PCWSTR psz,
  _Out_  PROPVARIANT *ppropvar
);

Parameters

psz [in]

Type: PCWSTR

Pointer to a buffer that contains the source Unicode string.

ppropvar [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

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

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

PropVariantToStringVector
InitPropVariantFromString
InitPropVariantFromStringVector
InitVariantFromStringArray

 

 

Community Additions

ADD
Show:
© 2014 Microsoft