CRegistry:SetStr CRegistry:SetRgb

CRegistry:GetRgb


The GetRgb method returns an RGB value string form a registry key. The return value is in a form like "100,240,255" which contains R, G, and B color values between 0 and 255. The method also specifies a default value to be returned if the named value or key does not already exist in the Registry. You can work with the RGB string value using the CColorRef class.

Syntax

rgbValue = CRegistry:GetRgb( sName, rgbDefault )

  • rgbValue is an RGB string value returned from the Registry.
  • sName is the name of the value to fetch.
  • rgbDefault is the default value returned if sName is not found in the Registry.

Example

The following script opens a key specified by sKeyName and returns an RGB string value saved under the name "MyVal":

 

R = CRegistry:Open( sKeyName )

-- open the key and create a CRegistry object

rgb = R:GetRgb( "MyVal", "255,0,0" )

-- fetch the value of "MyVal", default to "255,0,0"

Printf( "MyVal= %s", rgb )

-- Result: MyVal= 255,0,0 (value did not already exist)

Related Topics

CRegistry, SetRgb, CColorRef