Lists a key's sub keys.

Syntax

List = SRP_Registry("LISTKEYS", Key, ValueName, Value, Error)

Returns

The key's list of sub keys, or "" if no sub keys were found or there was an error.

Value

The Value parameter is treated as a boolean option. Setting Value to 1 will return the sub keys as complete path strings. Setting Value to 0 will return only the sub keys' names. The default is 0.

Errors

If the service returns "", then an error may have occurred. In this event, the Error parameter can be one of the following messages:

ErrorDescription
""There was no error. The key was found but has no sub keys.
"Failed to open key"The key could not be opened.

Remarks

The LISTKEYS service generates a dynamic array of all sub keys within a given key. The sub keys are @FM delimited and in no particular order. The format of the keys depends on the Value parameter. Set it to one to get a list of the full key paths:

<1> HKCU\Software\MyApp\SubKey1
<2> HKCU\Software\MyApp\SubKey2
<3> HKCU\Software\MyApp\SubKey3

Set the Value parameter to 0 or leave it unassigned to get only the sub key names:

<1> SubKey1
<2> SubKey2
<3> SubKey3

If this service returns "", then use the Error property to determine whether the list is empty due to an error or to the fact that the key has no values.

Us the LISTVALUES service to get a key's values.

Example

* Get a key's list of sub keys with full paths
List = SRP_Registry("LISTKEYS", "HKCU\Software\MyApp", "", 1, Error) EQ 0 then
If List EQ "" AND Error NE "" then
   Msg(@Window, "LISTKEYS Error: ":Error:@FM:@FM:@FM:4)
end

* Get a key's list of sub keys with names only
List = SRP_Registry("LISTKEYS", "HKCU\Software\MyApp", "", 0, Error) EQ 0 then
If List EQ "" AND Error NE "" then
   Msg(@Window, "LISTKEYS Error: ":Error:@FM:@FM:@FM:4)
end
  • No labels