Clarion ProScan Help

RegINIClass

RegINIClass

Previous topic Next topic  

RegINIClass

Previous topic Next topic  

The RegINIClass is a utility class that makes it easy to store settings in either the System Registry or an INI file.  It allows you to transition between the two without making any changes in your code.

 

 

WARNING and NOTICE of Zero Liability

 

This class is used by the ProSeries tools and has been tested (in its unaltered state) to be safe to read/write data from the System Registry.  While you are allowed to use the class in other parts of your program, YOU are responsible for using the correct settings for root keys, sub keys and values.

 

We assume ZERO LIABILITY for any damage that you do to your own computer (or those of your clients) as a result of using this class code beyond the bounds of the ProSeries tool that it came with.

 

USE AT YOUR OWN RISK!!

 

 

The RegINIClass is defined as:

 

PS_RegINIClass CLASS

Storage         STRING(8)         !Registry or INIFile

INIFileName     STRING(512)

RegistryRoot    LONG

RegistryKey     STRING(1024)

Initialized     BYTE              !TRUE/FALSE

Status          LONG

Init            PROCEDURE( STRING sStorageToUse, STRING sValue1, <STRING sValue2> )

GetData         PROCEDURE( STRING sSection, <STRING sEntry>, <STRING sValue>, <STRING sJunkValue> ),STRING

PutData         PROCEDURE( STRING sSection, <STRING sEntry>, <STRING sValue>, <STRING sJunkValue> )

DeleteData      PROCEDURE( STRING sSection, <STRING sEntry> )

             END !CLASS

 

Using the class is easy.  The ProScan template declares an instance of the class for you as RIC.

 

The class takes a classic two-step approach to usage:  Initialize and call.

 

Before you can use the class, you initialize it.

 

The initialization process tells the class which storage method you are using and where to store the data.  In the case of the INI method, it is the name of the INI file to use.  In the case of the Registry method, it is the root key and the subkey to use.

 

Hint:  Once set - the Init parameters are "sticky" and do not need to be called again unless you are changing them.

 

Also remember that the global extension template takes care of the initialization process for you, but you can also reinitialize on the fly to use a different file or key.

 

 

A note on compatibility...

 

For maximum compatibility, the syntax for the class accepts the same number of parameters as a standard call to GetINI or PutINI.  This allows you to do a simple search/replace in your code to use it in other parts of your program.

 

Search for GetINI and replace it with RIC.GetData

Search for PutINI and replace it with RIC.PutData

 

This assumes you are using the global extension template which declares the instance of the class as RIC or have used the same name in your declaration.