The RegQueryValue function retrieves the value associated with the unnamed value for a specified key in the registry. Values in the registry have name, type, and data components. This function retrieves the data for a key’s first value that has a NULL name. This function is provided for compatibility with Windows version 3.1. Win32-based applications should use the RegQueryValueEx function.
LONG RegQueryValue(
HKEY hKey, |
// handle of key to query |
LPCTSTR lpSubKey, |
// address of name of subkey to query |
LPTSTR lpValue, |
// address of buffer for returned string |
PLONG lpcbValue |
// address of buffer for size of returned string |
); |
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Windows NT only: HKEY_PERFORMANCE_DATA
Windows 95 only: HKEY_DYN_DATA
If lpValue is NULL, and lpcbValue is not NULL, the function
places the size in bytes of the data referenced by the value key, including
the terminating null character, into the variable pointed to by lpcbValue.
This lets an application determine how to best preallocate a buffer for the
value key’s data.
If the buffer specified by lpValue parameter is not large enough to hold the data, the function returns the value ERROR_MORE_DATA, and stores the required buffer size, in bytes, into the variable pointed to by lpcbValue.
If lpValue is NULL, the function returns ERROR_SUCCESS, and stores the size of the string, in bytes, into the variable pointed to by lpcbValue. This lets an application determine the best way to allocate a buffer for the value key’s data.
In all cases the value returned in lpcbValue always includes the size of the terminating null character in the string.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
The key identified by the hKey parameter must have been opened with KEY_QUERY_VALUE access (KEY_READ access includes KEY_QUERY_VALUE access).
If the ANSI version of this function is used (either by explicitly calling RegQueryValueA or by not defining UNICODE before including the WINDOWS.H file), this function converts the stored Unicode string to an ANSI string before copying it to the buffer specified by the lpValue parameter.
RegEnumKey, RegEnumKeyEx, RegEnumValue, RegQueryInfoKey, RegQueryValueEx, RegSetValue, RegSetValueEx
file: /Techref/os/win/api/win32/func/src/f73_7.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/27 16:19,
18.222.44.156:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/os/win/api/win32/func/src/f73_7.htm"> RegQueryValue</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.