Gets a value from the Windows system registry.
RegistryGet ( key, valuename, { valuetype }, valuevariable )
Argument |
Description |
---|---|
key |
A string whose value names the key in the system registry whose value you want. To uniquely identify a key, specify the list of parent keys above it in the hierarchy, starting with the root key. The keys in the list are separated by backslashes. |
valuename |
A string containing the name of a value in the registry. Each key can have one unnamed value and several named values. For the unnamed value, specify an empty string. |
valuetype |
A value of the RegistryValueType enumerated datatype identifying the datatype of a value in the registry. Values are:
|
valuevariable |
A variable corresponding to the datatype of valuetype in which you want to store the value obtained from the system registry for the specified key and value name. |
Integer. Returns 1 if it succeeds and -1 if an error occurs. An error is returned if the datatype of valuevariable does not correspond to the datatype specified in valuetype.
Long string values (more than 2048 bytes) should be stored as files and the file name stored in the registry. For more information about keys and value names in the system registry, see RegistrySet.
This statement obtains the value for the name Title and stores it in the string ls_titlefont:
string ls_titlefont
RegistryGet( &
"HKEY_LOCAL_MACHINE\Software\MyApp.Settings\Fonts", & "Title", RegString!, ls_titlefont)
This statement obtains the value for the name NameOfEntryNum and stores it in the long ul_num:
ulong ul_num RegistryGet("HKEY_USERS\MyApp.Settings\Fonts", & "NameOfEntryNum", RegULong!, ul_num)