Registry.ReadInteger

Top  Previous  Next

 

Syntax

function Registry.ReadInteger(Registry: pointer; ValueName: string): integer

 

Alternative Names

ibec_reg_ReadInteger

 

Description

Reads an integer value identified by ValueName in the current open key for the given Registry object.

 

Returns the integer value from the registry, or NULL if the value cannot be converted into an integer.

 

See also

Registry.OpenKey
Registry.DeleteValue

 

Example

execute udsblock 

returns( out_vc varchar(1000), out_int integer, out_float double precision, out_time timestamp)

as

begin

  reg = Registry.Open(__HKEY_CURRENT_USER, 0);

  try

     /* returns -1 (true) */

  out_int = Registry.OpenKey(reg, '\Software\Upscene\DScript\Test', __TRUE);

  

  /* this key doesn't exist, so this returns 0 (false) */

  out_int = Registry.KeyExists(reg, 'Newkey');

  

     /* write string value, value name now exists */

  Registry.WriteString(reg, 'NewValue', 'string');

  out_int = Registry.ValueExists(reg, 'NewValue');

  /* returns -1 (true) */

  Registry.DeleteValue(reg, 'NewValue');

  out_int = Registry.ValueExists(reg, 'NewValue');

  /* returns 0 (false) again */

  

  /* write and read several values */

  Registry.WriteInteger(reg, 'NameInt', 12);

  out_int = Registry.ReadInteger(reg, 'NameInt');

  

  Registry.WriteFloat(reg, 'NameFloat', 13.13);

  out_float = Registry.ReadFloat(reg, 'NameFloat');

  

  Registry.WriteBool(reg, 'NameBool', __FALSE);

  out_int = Registry.ReadBool(reg, 'NameBool');

  

  Registry.WriteTime(reg, 'NameTime', TIME'12:13');

  out_time = Registry.ReadTime(reg, 'NameTime');

  

  Registry.WriteDate(reg, 'NameDate', DATE'2024-12-23');

  out_time = Registry.ReadDate(reg, 'NameDate');

  

  Registry.WriteDateTime(reg, 'NameDateTime', TIMESTAMP'2024-12-23 12:13');

  out_time = Registry.ReadDateTime(reg, 'NameDateTime');

  

  Registry.CloseKey(reg);

  /* delete the test key */

  out_int = Registry.DeleteKey(reg, '\Software\Upscene\DScript\Test');

  /* test key existence, returns 0 (false) */

  out_int = Registry.KeyExists(reg, '\Software\Upscene\DScript\Test');

  finally

    Registry.Free(reg);

  end

end;