|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| Yes
| Import Library
| advapi32.lib
| Header File
| winreg.h
| Unicode
| WinNT
| Platform Notes
| None
|
|
|
RegQueryValue
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
| );
|
|
Parameters
hKey
Identifies a currently open key or any of the following predefined reserved
handle values:
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey
Points to a null-terminated string containing the name of the subkey of the hKey parameter for which a value is to be retrieved. If this parameter is NULL or
points to an empty string, the function retrieves the value set by the RegSetValue function for the key identified by hKey.
lpValue
Points to a buffer that receives the value associated with the lpSubKey parameter. The buffer should be big enough to contain the terminating null
character. This parameter can be NULL if the data is not required.
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.
lpcbValue
Points to a variable specifying the size, in bytes, of the buffer pointed to
by the lpValue parameter. When the function returns, this variable contains the size of the
data copied to lpValue, including the terminating null character.
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.
Return Values
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.
Remarks
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 RegQueryValue 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.
See Also
RegEnumKey, RegEnumKeyEx, RegEnumValue, RegQueryInfoKey, RegQueryValueEx, RegSetValue, RegSetValueEx
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|