Extensions Reference

Extensions Reference > exRegistry


regGetString

string regGetString(string Valuename);

 

Retrieves a STRING value from the registry

The REGGETSTRING function retrieves the contents of the specified value from a previously opened registry key (opened by exRegistry::regOpenKey or exRegistry::regCreateKey). It is good practice to use exRegistry::regCheckExists to ensure the value already exists (although this is not essential).

Note: It is extremely important that the right function be used to retrieve the right value type from the registry. REGGETSTRING must only be called to obtain the contents of REG_SZ values.

 

Parameters

Valuename

The name of the value to retrieve the contents of.

 

Return Value

The contents of the value, or "Error reading Value" if the value couldn't be retrieved (for example: security permissions prevent it, the value doesn't exist etc).

 

Example Code

// Open the Brass registry key for the current user
if(regOpenKey("HKCU", "Software\\32Bits\\Brass") == True)
{
    // Retrieve a string from the open key
    if(regCheckExists("MyStringVal") == TRUE)
    {
        // Read the contents of MyStringVal into MyString
        string MyString = regGetString("MyStringVal");
    }

    regCloseKey();
}