Skip to content

ReadString - cRegistry

Reads a String value from the currently open Key

Type: Function
Return Data Type: String

Parameters

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

Syntax

Function ReadString String sValueName Returns String

Call Example

Get ReadString sValueName to StringVariable

Description

Use ReadString to read a String value from the currently open Key. The value must already exist, and you can use the ValueExists function to verify this.

Use cRegistry.pkg

Object oRegistry is a cRegistry

    Procedure DoReadString
        Boolean bOpened
        String sKey sValue sDirectory

        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
                Get ReadString sValue To sDirectory
                Showln sValue ' = ' sDirectory
            End
            Else Showln "Value does not exist"

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

        Else ShowLn 'Could not open Key'
    End_Procedure

End_Object

Send DoReadString of oRegistry

Return Value

A string repersenting the data held in the queried Value.