7 accessing the registry – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 111

Advertising
background image

N

AURTECH

W

EB

B

ROWSER AND

T

ERMINAL

E

MULATION FOR

W

INDOWS

CE

AND

W

INDOWS

M

OBILE




CETerm Scripting Guide

Page 111


{
status = F.Write( filename, addedContent );
}

return status;
}

5.7

A

CCESSING THE

R

EGISTRY

The registry on a Windows CE device is a form of database which contains most
of the device configuration. The Registry automation object allows you to
read, write and delete registry keys and values.

WARNING: Altering the registry can make your device unusable. Be sure you

understand the effect of changing values and accept the responsibility.


The registry has a hierarchical str

ucture. The “keys” are similar to file folders and

the “values” inside a key are similar to files in a folder. Several Registry
methods require a “fully qualified” value name which contains the full key
hierarchy, begins with a “root” key, and ends with the value name. This fully
qualified value name is similar to a file name with the full path.

The following example creates a new key and value and confirms that it can be
read.

/* NewRegistryDWORD */
function NewRegistryDWORD( keyname, valuename, valuedata )
{
var status = false;
var R = OS.Registry;

// Check if file exists
var fullyQualifiedKey = "HKEY_LOCAL_MACHINE\\" +
keyname + "\\" + valuename;

if (!R.WriteValue( fullyQualifiedKey, valuedata, "REG_DWORD" ))
{
// Check if can read value
var readdata = R.ReadValue( fullyQualifiedKey );
if (readdata == valuedata)
{
status = true;
}
}

if (!status)
{

Advertising
This manual is related to the following products: