GetRegistryValue method


Prototype

GetRegistryValue Proto hKey:HKEY, lpszSubKey:LPSTR, lpszValueName:LPSTR, lpszValue:LPSTR

Syntax

Invoke GetRegistryValue, hKey, lpszSubKey, lpszValueName, lpszValue

Function

Retrieves the data of the specified named value from the specified registry subkey.

Parameters

hKey

Handle to one of the following predefined keys:

ecClassesRoot
ecCurrentUser
ecLocalMachine
ecUsers
ecPerformanceData
ecCurrentConfig
ecDynData

lpszSubKey

Pointer to the effective address of a null-terminated string that names the path of the subkey containing the named value whose value is to be retrieved.

lpszValueName

Pointer to the effective address of a null-terminated string that names the named value whose value is to be retrieved.

lpszValue

Pointer to the effective address of a null-terminated string to receive the retrieved value.

Return value

Eax returns TRUE if succesful, or FALSE if not.


REMARKS: The lpszValue parameter points to a null-terminated string to receive the retrieved data. You can fill this parameter with the desired default value before calling the method, as it will return the same value if the specified named value is not found.

REMARKS: The GetRegistryValue method expects lpszSubKey and lpszValueName to be Unicode strings, and fills lpszValue with a Unicode value if the application is running as Unicode. Otherwise, it expects lpszSubKey and lpszValueName to be ANSI strings, and fills lpszValue with an ANSI value (see the IsAppUnicode method). You can call GetRegistryValueA to get ANSI values in Unicode applications, or GetRegistryValueW to get Unicode values in ANSI applications.

IMPORTANT: The string pointed by lpszValue must be able to allocate up to MAX_PATH characters.