SHQueryValueEx function

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

Syntax


DWORD SHQueryValueEx(
  _In_         HKEY hkey,
  _In_opt_     LPCTSTR pszValue,
  LPDWORD pdwReserved,
  _Out_opt_    LPDWORD pdwType,
  _Out_opt_    LPVOID pvData,
  _Inout_opt_  LPDWORD pcbData
);

Parameters

hkey [in]

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

pszValue [in, optional]

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.

pdwType [out, optional]

Type: LPDWORD

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

pvData [out, optional]

Type: LPVOID

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

pcbData [in, out, optional]

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.

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

SHQueryValueExW (Unicode) and SHQueryValueExA (ANSI)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft