PSStringFromPropertyKey function (propsys.h)

Creates a string that identifies a property from that property's key.

Syntax

PSSTDAPI PSStringFromPropertyKey(
  [in]  REFPROPERTYKEY pkey,
  [out] LPWSTR         psz,
  [in]  UINT           cch
);

Parameters

[in] pkey

Type: REFPROPERTYKEY

Reference to a PROPERTYKEY structure that identifies a property.

[out] psz

Type: LPWSTR

Pointer to a buffer that receives the output string. The buffer should be large enough to contain PKEYSTR_MAX WCHARs.

[in] cch

Type: UINT

The length of the buffer pointed to by psz, in WCHARs.

Return value

Type: HRESULT

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

Remarks

The string format retrieved is "{propkey.fmtid} propkey.pid". For example, the output string for PKEY_Title is "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2".

Examples

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

WCHAR szKey[PKEYSTR_MAX]

HRESULT hr = PSStringFromPropertyKey(PKEY_Title, szKey, ARRAYSIZE(szKey));

if (SUCCEEDED(hr))
{
    // szKey is now valid.
}

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 propsys.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0

See also

PSGetNameFromPropertyKey

PSPropertyKeyFromString