User Tools

Site Tools


getreg_get_windows_registry_entry_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== GETREG (get Windows registry entry) ====== Previous pageReturn to chapter overviewNext page

 

GETREG(root, keyname [, valuename] [, *? valuetype] ),STRING

blk2blue.jpg

GETREG Gets the value of a specific key and/or value from the system registry.
root A LONG integer, variable or expression that contains the root section of the registry from which to obtain the value. Valid values for this are defined in equates.clw and are as follows:
REG_CLASSES_ROOT
REG_CURRENT_USER
REG_LOCAL_MACHINE
REG_USERS
REG_PERFORMANCE_DATA
REG_CURRENT_CONFIG
REG_DYN_DATA
keyname A STRING constant, variable or expression that contains the key name of the key whose value is to be queried. This may contain a path separated by backslash '\' characters.
valuename A STRING constant, variable or expression that contains the name of the value to be queried, if omitted, the value associated directly with the key is returned.
valuetype An optional integer variable that receives the type of value. It can be used for correct interpreting of the returned valuename.
Supported types are:
REG_NONE ' value is ignored
REG_SZ - value is a string
REG_EXPAND_SZ - value is a string that can contain unexpanded environment variables
REG_MULTI_SZ - value is a string that consists of substrings separated with '<;0>' characters; last substring is terminated with two consecutive '<;0>' characters. NOTE: this value result can not be assigned to a CSTRING
REG_DWORD - value is a 32 bit number
REG_DWORD_LITTLE_ENDIAN - value is a 32 bit number
REG_DWORD_BIG_ENDIAN - value is a 32 bit number
REG_QWORD - value is a 64 bit number
REG_QWORD_LITTLE_ENDIAN - value is a 64 bit number
REG_BINARY - value string is a binary data of any form
The REG_* constants are declared in EQUATES.CLW

The GETREG function returns the value of named entry in the system registry as a Clarion string. If the requested entry does not exist, an empty string is returned.

Vista and Clarion Built-in Registry Functions

On Vista, a (non-elevated) app can READ the registry key HKLM (local machine) with no problems, but as far as writing to the Registry it needs to use HKCU (current user).

If you code sign your executable and run with elevated privileges then you can write to HKLM

Return Data Type:     STRING

Example:

 PROGRAM

 MAP

 END

 INCLUDE('EQUATES')

CurrentPath CSTRING(100)

ColorScheme CSTRING(100)

 CODE

 

  ColorScheme =|

  GETREG(REG_CURRENT_USER,'Control Panel\Current','Color Schemes')

  !get the current user's color scheme

See Also:

PUTREG, DELETEREG GETREGSUBKEYS, GETREGVALUES

getreg_get_windows_registry_entry_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1