Exporter (0) Imprimer
Développer tout
EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

SHRegSetUSValue function

Sets a registry subkey value in a user-specific subtree (HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE).

Syntax


LSTATUS SHRegSetUSValue(
  _In_      LPCTSTR pszSubKey,
  _In_      LPCTSTR pszValue,
  _In_      DWORD dwType,
  _In_opt_  LPVOID *pvData,
  _In_opt_  DWORD cbData,
  _In_opt_  DWORD dwFlags
);

Parameters

pszSubKey [in]

Type: LPCTSTR

A pointer to a null-terminated string with the name of the subkey.

pszValue [in]

Type: LPCTSTR

A pointer to a null-terminated string that specifies the name of the value.

dwType [in]

Type: DWORD

Type of data to be stored. This parameter must be the REG_SZ type. For more information, see Registry Data Types.

pvData [in, optional]

Type: LPVOID*

Apointer to a null-terminated string that contains the value to be set for the specified key.

cbData [in, optional]

Type: DWORD

Length, in bytes, of the string pointed to by the pvData parameter, not including the terminating null character.

dwFlags [in, optional]

Type: DWORD

Flags indicating where the data should be written.

SHREGSET_HKCU

Write to HKEY_CURRENT_USER if empty.

SHREGSET_FORCE_HKCU

Write to HKEY_CURRENT_USER.

SHREGSET_HKLM

Write to HKEY_LOCAL_MACHINE if empty.

SHREGSET_FORCE_HKLM

Write to HKEY_LOCAL_MACHINE.

SHREGSET_DEFAULT

Equivalent to (SHREGSET_FORCE_HKCU | SHREGSET_HKLM).

Return value

Type: LSTATUS

Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.

Remarks

This function opens the key each time it is used. If your code involves setting a series of values in the same key, it is more efficient to open the key once with SHRegOpenUSKey and then use SHRegWriteUSValue to write the data.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

Unicode and ANSI names

SHRegSetUSValueW (Unicode) and SHRegSetUSValueA (ANSI)

 

 

Ajouts de la communauté

AJOUTER
Microsoft réalise une enquête en ligne pour recueillir votre opinion sur le site Web de MSDN. Si vous choisissez d’y participer, cette enquête en ligne vous sera présentée lorsque vous quitterez le site Web de MSDN.

Si vous souhaitez y participer,
Afficher:
© 2014 Microsoft