Skip to content

ValueExists - cRegistry

Tests whether a named Value exists in the open Key

Type: Function
Return Data Type: Boolean

Parameters

Parameter Type Description
sValueName String The name of the Value to read data from

Syntax

Function ValueExists String sValueName Returns Boolean

Call Example

Get ValueExists sValueName to BooleanVariable

Description

Use the ValueExists function to verify that a Value of the currently open Key exists before trying to access it.

Use cRegistry.pkg

Object oRegistry is a cRegistry

    Procedure DoShowIfValueExists
        Boolean bOpened
        String sKey sValue

        Move "SOFTWARE\Microsoft\MediaPlayer" To sKey
        Move "Installation Directory" To sValue

        // Set the root key to LOCAL_MACHINE...
        Set phRootKey To HKEY_LOCAL_MACHINE

        Get OpenKey sKey To bOpened
        If bOpened Begin
            If (ValueExists(self, sValue)) Begin
                Showln "Value exists"
            End
            Else Showln "Value does not exist"

            // must close Keys that we open...
            Send CloseKey
        End
    End_Procedure

End_Object

Send DoShowIfValueExists of oRegistry

See Also

ValueType | ValueLength

Return Value

ValueExists returns True if the named Value exists. If the Value does not exist, then it returns False.