Registry.DeleteKey

Top  Previous  Next

 

Syntax

function Registry.DeleteKey(Registry: pointer; Key: string): boolean

 

Alternative Names

ibec_reg_DeleteKey

 

Description

Removes a registry key and its values for the given Registry object for the path given in Key.

 

Returns TRUE if the key is deleted, FALSE otherwise.

 

See also

Registry.Open
Registry.OpenKey
Registry.CreateKey
Registry.KeyExists
Registry.CloseKey

 

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;