The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



GetRegValue


Unit: SDL_filesys
Class: none
Declaration: function GetRegValue (RootKey: HKEY; SubKey, ValueID: string): string;

The function GetRegValue reads a value of the Windows registry. The parameter RootKey defines the root key and can take one of the following values: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG and HKEY_DYN_DATA. The parameter SubKey specifies the key (including its path) used within the branch of the root key and the parameter ValueID specifies the value to be retrieved.

The function returns the registry value always as a string, even if the value is stored as an integer. If the type of the stored value is unknown or not supported then the function returns the string 'ERROR (unknown type)'. If the value does not exist an empty string is returned.

Example: The statement
GetRegValue (HKEY_CURRENT_USER, '/Software/MyProduct/Customization/BgndColor');
returns the value named BgndColor which is stored under the registry key HKEY_CURRENT_USER/Software/MyProduct/Customization.



Last Update: 2023-Feb-06