This topic has not yet been rated - Rate this topic

SHQueryValueEx function

Applies to: desktop apps only

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

Minimum supported server

Windows 2000 Server

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

Unicode and ANSI names

SHQueryValueExW (Unicode) and SHQueryValueExA (ANSI)

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ