Registry object
The object with functions
for saving and restoring eBook data and working with the system
registry.
Addressing the Registry object:
window.external.Registry
Functions of this object can be divided into two groups. The first
group includes functions for working with data stored in the registry
key of the eBook. The second group includes functions for working
with the entire system registry.
First group functions
EBookValueExists(Name)
Check if the value exists in the ebook registry, where Name is the
name of the value.
Call: window.external.Registry.EBookValueExists(Name);
Return value: true if the value with this name exists; false if
otherwise.
EBookWriteString(Name,Value)
Write a string value to the ebook registry key, where Name is the
name of the value, Value is the string to be written.
Call: window.external.Registry.EBookWriteString(Name,Value);
Return value: no.
EBookReadString(Name)
Read a string value from the ebook registry key, where Name is the
name of the value.
Call: window.external.Registry.EBookReadString(Name);
Return value: an empty string if there is no such value; the string
from the registry if otherwise.
EBookWriteInt(Name,Value)
Write an integer value to the ebook registry key, where Name is
the name of the value, Value is the integer to be written.
Call: window.external.Registry.EBookWriteInt(Name,Value);
Return value: no.
EBookReadInt(Name)
Read an integer value from the ebook registry key, where Name is
the name of the value.
Call: window.external.Registry.EBookReadInt(Name);
Return value: 0 if there is no such value; the integer from the
registry if otherwise.
Note.
The following names of values are reserved for internal use and
can not be used:
EBookExitURLOpened
Key
LastLeftPage
LastLeftPageScrollX
LastLeftPageScrollY
LastMainPage
LastMainPageScrollX
LastMainPageScrollY
MainFormSettings
UnregEBookExitURLOpened
UserName
Second group functions
Be careful while working with the functions of this group because
modifying data in the system registry may make the entire system
of the user work incorrectly. Work only with those keys and values
whose modification will not lead to unpredictable consequences.
When you work with the procedures of this group, RootKey is defined
with the help of the following string abbreviations:
| Abbreviation |
RootKey |
| HKCU |
HKEY_CURRENT_USER |
| HKLM |
HKEY_LOCAL_MACHINE |
| HKCR |
HKEY_CLASSES_ROOT |
| HKCC |
HKEY_CURRENT_CONFIG |
| HKDD |
HKEY_DYN_DATA |
| HKPD |
HKEY_PERFORMANCE_DATA |
| HKU |
HKEY_USERS |
Working with registry keys.
RegKeyExists(RootKey,Key)
Check if the key exists in the system registry, where RootKey is
one of the RootKey abbreviations, Key is the key.
Call: window.external.Registry.RegKeyExists(RootKey,Key);
Return value: true if the key exists; false if otherwise.
RegCreateKey(RootKey,Key)
Create a key in the system registry, where RootKey is one of the
RootKey abbreviations, Key is the key.
Call: window.external.Registry.RegCreateKey(RootKey,Key);
Return value: true if the key is successful created; false if otherwise.
RegDeleteKey(RootKey,Key,DelIfHasSubkeys)
Remove a key from the system registry, where RootKey is one of the
RootKey abbreviations, Key is the key, DelIfHasSubkeys - if the key
contains subkeys and this parameter is set to true, the key will
be removed anyway, if it is set to false, the key will not be removed.
Call: window.external.Registry.RegDeleteKey(RootKey,Key,DelIfHasSubkeys);
Return value: true if the key is successfully removed; false if
otherwise.
GetEBookKey()
Returns the key where the
eBook values are stored.
Note: RootKey for the key of eBook values is always 'HKCU'.
Call: window.external.Registry.GetEBookKey();
Return value: the eBook key in the system registry.
HasFullAccess(RootKey,Key)
Get information about the level of access for working with the key,
where RootKey is one of the RootKey abbreviations, Key is the key.
Call: window.external.Registry.HasFullAccess(RootKey,Key);
Return value: true if the full access to the key is available; false
if otherwise.
Working with registry values.
RegValueExists(RootKey,Key,Name)
Check if the value exists in the registry, where RootKey is one
of the RootKey abbreviations, Key is the key and Name is the name
of the value.
Call: window.external.Registry.RegValueExists(RootKey,Key,Name);
Return value: true if the value with this name exists; false if
otherwise.
ValuesCount(RootKey,Key)
Get the number of values in a registry key, where RootKey is one
of the RootKey abbreviations, Key is the key.
Call: window.external.Registry.ValuesCount(RootKey,Key);
Return value: the number of values.
ValuesNames(RootKey,Key,Idx)
Get the list of value names in a registry key, where RootKey is
one of the RootKey abbreviations, Key is the Key, Idx the number
of the value (where 0 <= Idx < the number of values).
Attention! Unlike other functions, this function cannot be called
via window.external.Registry.ValuesNames(RootKey,Key,Idx). To be
able to work with this function, you should assign the object to
a variable first. Besides, this function must be called with the
Idx parameter less than zero when it is called for the first time.
For example:
reg = window.external.Registry; // Assigning the object to the reg
variable
RKey='HKCU';
VKey='Software\\eBook Maestro'; // The key to get the
list of values from
total = reg.ValuesNames(RKey,VKey,-1); // Initializing
the list of values
for (i=0;i<total;++i)
alert(reg.ValuesNames(RKey,VKey,i)); //
Alerting about each values in the key
The reason for this requirement is that each time window.external.Registry
is called, new memory is allocated for the Registry object. Therefore,
new memory for the list of values in the key is also allocated. To
start working with a certain object without creating a new one, it
should be assigned to a variable. The list itself is filled by calling
the procedure with the Idx parameter less than zero.
That is all for you to be able to work with two or more registry
keys simultaneously by assigning separate objects to different variables.
Call: reg = window.external.Registry; total = reg.ValuesNames(RKey,VKey,-1);
reg.ValuesNames(RKey,VKey,idx);
Return value: if Idx<0, the list is initiated and the number
of values is returned, if Idx>=0, a string with the value name.
RegReadString(RootKey,Key,Name)
Read a string value from the registry, where RootKey is one of the
RootKey abbreviations, Key is the key and Name is the name of the
value.
Call: window.external.Registry.RegReadString(RootKey,Key,Name);
Return value: an empty string if there is no such value; the string
from the registry if otherwise.
RegWriteString(RootKey,Key,Name,Value)
Write a string value to the registry, where RootKey is one of the
RootKey abbreviations, Key is the key, Name is the name of the value
and Value is the string to be written.
Call: window.external.Registry.RegWriteString(RootKey,Key,Name,Value);
Return value: no.
RegReadInt(RootKey,Key,Name)
Read an integer value from the registry, where RootKey is one of
the RootKey abbreviations, Key is the key and Name is the name of
the value.
Call: window.external.Registry.RegReadInt(RootKey,Key,Name);
Return value: 0 if there is no such value; the integer from the
registry if otherwise.
RegWriteInt(RootKey,Key,Name,Value)
Write an integer value to the registry, where RootKey is one of
the RootKey abbreviations, Key is the key, Name is the name of the
value and Value is the integer to be written.
Call: window.external.Registry.RegWriteInt(RootKey,Key,Name,Value);
Return value: no.
RegDeleteValue(RootKey,Key,Name)
Remove a value from a key of the system registry, where RootKey
is one of the RootKey abbreviations, Key is the key and Name is the
name of the value.
Call: window.external.Registry.RegDeleteValue(RootKey,Key,Name);
Return value: true if the key is successfully removed; false if
otherwise.
RegWriteExpandString(RootKey,Key,Name,Value)
Write an Expanded_String value to the registry, where RootKey is
one of the RootKey abbreviations, Key is the key, Name is the name
of the value and Value is the string to be written.
Call: window.external.Registry.RegWriteExpandString(RootKey,Key,Name,Value);
Return value: no. |