Επεξεργασία

Κοινή χρήση μέσω


SHQueryValueExA function (shlwapi.h)

Opens a registry key and queries it for a specific value.

Syntax

LSTATUS SHQueryValueExA(
  [in]                HKEY   hkey,
  [in, optional]      LPCSTR pszValue,
                      DWORD  *pdwReserved,
  [out, optional]     DWORD  *pdwType,
  [out, optional]     void   *pvData,
  [in, out, optional] DWORD  *pcbData
);

Parameters

[in] hkey

Type: HKEY

A handle to the currently open key, or any of the following predefined values.

HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG

HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

HKEY_PERFORMANCE_DATA

HKEY_USERS

[in, optional] pszValue

Type: LPCTSTR

The address of the null-terminated string that contains the name of the value to be queried.

pdwReserved

Type: LPDWORD

Reserved. Must be NULL.

[out, optional] pdwType

Type: LPDWORD

The address of the variable that receives the key's value type. For more information, see Registry Data Types.

[out, optional] pvData

Type: LPVOID

The address of the buffer that receives the value's data. This parameter can be NULL if the data is not required.

[in, out, optional] pcbData

Type: LPDWORD

The address of the variable that specifies the size, in bytes, of the buffer pointed to by the pvData parameter. When the function returns, this variable contains the size of the data copied to pvData.

Return value

Type: DWORD

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

Note

The shlwapi.h header defines SHQueryValueEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)