ReadVariant(ValueName: String): Variant;
ValueName. Name of the parameter, which value must be obtained.
The ReadVariant method reads value of the Variant format from string parameter in the registry without checking parameter availability.
If the parameter with the ValueName name does not exist, an exception is thrown.
Executing the example requires that the registry subkey [HKEY_CURRENT_USER\Software\MyProject\Params] contains a string parameter with the Param1 name with a value in the Variant format stored in it.
Add a link to the Registry system assembly.
Sub UserProc;
Var
RegKey, SubKey: IRegistryKey;
v: Variant;
Begin
RegKey := RegistryClass.CurrentUser;
SubKey := RegKey.OpenSubKey("Software\MyProject\Params", False);
If SubKey.ValueExists("Param1") Then
v := SubKey.ReadVariant("Param1");
End If;
End Sub UserProc;
After executing the example the Param1 parameter is searched in the registry subkey [HKEY_CURRENT_USER\Software\MyProject\Params]. If the parameter exists, the value contained in this parameter is read into the "v" variable.
See also: