Skip to content

GetValues - cRegistry

Retrieves the names of all Values belonging to the open Key

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
hoArray Handle An object-handle of an Array-based object to receive the names of the Values

Syntax

Function GetValues Handle hoArray Returns Integer

Call Example

Get GetValues hoArray to IntegerVariable

Description

The GetValues function populates an array with the names of the Values of the Key that is presently open. You pass the handle of an array-based object that you want the names appended to. Upon returning from the method, each Value name is stored in individual items in the array. The array is not cleared before the names are appended.

Sample

In this sample, the names of all Values belonging to the "Software\Microsoft\Internet Explorer" Key are displayed. First the Key is opened, and then an Array object is created to store the names. The object-handle of this array is passed to GetValues, which returns the number of Values that was added to the array. The contents of the array are then displayed, before finally deleting the array object that we created.

Use cRegistry.pkg

Object oRegistry is a cRegistry

    Procedure DoShowValues
        Boolean bOpened
        Handle hoArray
        Integer iValue iNumValues

        // Open the Key...
        Get OpenKey "Software\Microsoft\Internet Explorer" To bOpened
        If bOpened Begin
            // create an array to store the names...
            Get Create U_Array To hoArray

            Get GetValues hoArray To iNumValues
            Showln 'Number of Values =' iNumValues

            For iValue from 0 To (iNumValues -1)
                Showln iValue ' ' (Value(hoArray, iValue))
            Loop

            // destroy the array, as it is not needed anymore...
            Send Destroy of hoArray

            Send CloseKey // must close all open Keys
        End

    End_Procedure

End_Object

Send DoShowValues of oRegistry

See Also

GetSubkeys

Return Value

The return value is the number of Values that were added to the array