Fonction PSPropertyKeyFromString (propsys.h)

Convertit une chaîne en structure PROPERTYKEY .

Syntaxe

PSSTDAPI PSPropertyKeyFromString(
  [in]  LPCWSTR     pszString,
  [out] PROPERTYKEY *pkey
);

Paramètres

[in] pszString

Type : LPCWSTR

Pointeur vers une chaîne Unicode terminée par null à convertir.

[out] pkey

Type : PROPERTYKEY*

Lorsque cette fonction retourne, contient un pointeur vers une structure PROPERTYKEY .

Valeur retournée

Type : HRESULT

Si cette fonction réussit, elle retourne S_OK. Sinon, elle retourne un code d’erreur HRESULT.

Remarques

La chaîne à convertir doit être mise en forme en tant que "{fmtid} pid". Pour instance, la chaîne qui correspond à PKEY_Title est : "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2". PSStringFromPropertyKey génère des chaînes dans ce format.

Cette fonction réussit pour toute chaîne de clé de propriété valide, même si la propriété n’existe pas dans le schéma de propriété.

Exemples

L’exemple suivant, à inclure dans un programme plus grand, montre comment utiliser PSPropertyKeyFromString.

PROPERTYKEY key;

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

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

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows XP avec SP2, Windows Vista [applications de bureau uniquement]
Serveur minimal pris en charge Windows Server 2003 avec SP1 [applications de bureau uniquement]
Plateforme cible Windows
En-tête propsys.h
Bibliothèque Propsys.lib
DLL Propsys.dll (version 6.0 ou ultérieure)
Composant redistribuable Windows Desktop Search (WDS) 3.0

Voir aussi

PSGetPropertyKeyFromName

PSStringFromPropertyKey