RegDBQueryKeyCount

InstallShield 2018 » InstallScript Language Reference

Project • For InstallScript MSI and Basic MSI projects, it is recommended that you use the Registry view in InstallShield instead of creating registry keys and values through InstallScript code. Handling all of your registry changes in this way allows for a clean uninstallation through the Windows Installer service.

The RegDBQueryKeyCount function returns the number of subkeys or values under szKey. nItem specifies whether subkeys or values are counted.

Note • This function supports the 64-bit parts of the registry by using the REGDB_OPTION_WOW64_64KEY option. For more information, see REGDB_OPTIONS.

Syntax

RegDBQueryKeyCount ( szKey, nItem );

Parameters

RegDBQueryKeyCount Parameters

Parameter

Description

szKey

Specifies a key under the root key that was set by a previous call to RegDBSetDefaultRoot. Use backslashes to specify deeper levels of subkeys. To specify the root key, pass a null string ("").

nItem

Specifies which items should be counted. Pass one of the following predefined constants in this parameter:

REGDB_KEYS—The number of subkeys is returned.
REGDB_NAMES—The number of values is returned.

Return Values

RegDBQueryKeyCount Return Values

Return Value

Description

X

The number of items of the specified type under the specified key.

< ISERR_SUCCESS

Indicates that the function could not determine the number of items.

You can obtain the error message text associated with a large negative return value—for example, -2147024891 (0x80070005)—by calling FormatMessage.

Additional Information

RegDBQueryKeyCount is a general registry-related function, designed to work with all registry keys, including those handled by the special registry-related functions. For more information on special registry-related functions, see Special Registry-Related Functions.
By default, any text that is surrounded by angle brackets—for example, "<my registry entry text>"—in this function’s string arguments is interpreted as a text substitution and is processed accordingly. To disable text substitution processing for the string arguments of registry functions, call Disable with the REGISTRYFUNCTIONS_USETEXTSUBS argument.

See Also