Home > Language Reference > System Functions > ReadReg


The ReadReg function reads a value from the registry.


Use all registry functions with caution. If you are unfamiliar with the Windows Registry we recommend that you do not use these functions. Removing or modifying a registry entry can cause your system to become unstable.


ret = ReadReg(<registry_key>, <type>, <returned_value>)


<registry_key>. string, registry key (folder) to read. To read the default value of a key (named Default), use the entire path of the key and end it with the character \.

<type>, integer, constant. The possible values are:
<type>  Type of the returned value
 1  string
 2  string expand
 3  binary
 4  integer or dword 
 7  string multiple

If <type> is 1 or 2, a string is returned; if it is 7, a string is also returned but the binary zeroes separating the multiple strings are changed to \n\ and the ending double binary 0 is not returned. If <type> is 3 (binary), a string is returned containing a hexadecimal conversion of the binary value. A <type> of 4 returns an integer.

<returned_value>, variable. Data type is as explained above.

Return value

ret, optional numeric return value. If the function has successfully read the key, the return value is 0. If the function fails, the return value is a nonzero value (see System Functions Error Codes), and the <returned_value> is null or empty.


If there is an inconsistency between the specified <type> and the type of the returned value, a compilation error is generated.

See also