GetRegSubKey, GetRegSubKeyCount Functions

Purpose

To enumerate subkeys.

Syntax

$ = GetRegSubKey(hkey$, idx%)

% = GetRegSubKeyCount(hkey$)

Description

To enumerate subkeys, an application should initially call the GetRegSubKeyCount to obtain the number of subkeys for a specified hkey$. The application should call GetRegSubKey setting idx% to 1 and then increment the idx% parameter and call GetRegSubKey until the number of subkeys is reached.

Example

PrintWrap = 1

Local hkey$, i%

Print "Installed software:"

hkey$ = OpenRegKey("\\HKEY_CURRENT_USER\Software")

For i% = 1 To GetRegSubKeyCount(hkey$)

Write GetRegSubKey(hkey$, i);

Print ", ";

Next

CloseRegKey hkey$

Remarks

To retrieve the index of the last subkey, GetRegSubKeyCount uses the RegQueryInfoKey API function.

GetRegSubKey invokes the RegEnumKeyEx API function which enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called. RegEnumKeyEx API also retrieves the time it was last modified.

See Also

vbSaveSetting, vbDeleteSetting, vbGetSettingType, vbGetSetting, GetSetting, GetSettingType, SaveSetting, DeleteSetting, CreateRegKey, OpenRegKey, CloseRegKey, GetRegVal, GetRegValName, GetRegValType, GetRegValNameCount, GetRegSubKey, GetRegSubKeyCount

{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}