PSPropertyKeyFromString

PSPropertyKeyFromString function

Converts a string to a PROPERTYKEY structure.

Syntax


HRESULT PSPropertyKeyFromString(
  _In_  LPCWSTR     pszString,
  _Out_ PROPERTYKEY *pkey
);

Parameters

pszString [in]

Type: LPCWSTR

Pointer to a null-terminated, Unicode string to be converted.

pkey [out]

Type: PROPERTYKEY*

When this function returns, contains a pointer to a PROPERTYKEY structure.

Return value

Type: HRESULT

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

Remarks

The string to be converted must be formatted as "{fmtid} pid". For instance, the string that corresponds to PKEY_Title is: "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2". PSStringFromPropertyKey outputs strings in this format.

This function succeeds for any valid property key string, even if the property does not exist in the property schema.

Examples

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


PROPERTYKEY key;

HRESULT hr = PSPropertyKeyFromString(L"{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2", &key);

if (SUCCEEDED(hr))
{
    // The key variable is now valid.
}

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

Propsys.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

PSStringFromPropertyKey
PSGetPropertyKeyFromName

 

 

Show:
© 2016 Microsoft