100 lines
3.5 KiB
HTML
100 lines
3.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Registry</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Registry</h3>
|
|
|
|
If you want to store a small amount of information between runs of the
|
|
game there is a simpler mechanism than using a file. You can use the
|
|
registry. The registry is a large database that Windows maintains to
|
|
keep track of all sorts of settings for programs. An entry has a name,
|
|
and a value. You can use both string and real values. The following
|
|
functions exist:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>registry_write_string(name,str)</b></tt>
|
|
Creates an entry in the registry with the given name and string value.<br>
|
|
<tt><b>registry_write_real(name,x)</b></tt>
|
|
Creates an entry in the registry with the given name and real value.<br>
|
|
<tt><b>registry_read_string(name)</b></tt>
|
|
Returns the string that the given name holds. (The name must exist.
|
|
Otherwise an empty string is returned.)<br>
|
|
<tt><b>registry_read_real(name)</b></tt>
|
|
Returns the real value that the given name holds. (The name must exist.
|
|
Otherwise the number 0 is returned.)<br>
|
|
<tt><b>registry_exists(name)</b></tt>
|
|
Returns whether the given name exists.
|
|
</blockquote>
|
|
|
|
<p>
|
|
Actually, values in the registry are grouped into keys. The above routines
|
|
all work on values within the key that is especially created for your game.
|
|
Your program can use this to obtain certain information about the system
|
|
the game is running on. You can also read values in other keys. You can
|
|
write them also but be very careful. YOU CAN EASILY DESTROY YOUR SYSTEM this
|
|
way. (Write is not allowed in secure mode.) Note that keys are again
|
|
placed in groups. The following routines default work on the group
|
|
HKEY_CURRENT_USER. But you can change the root group. So, for
|
|
example, if you want to find out the current temp dir, use
|
|
|
|
<p>
|
|
<blockquote>
|
|
<pre>
|
|
path = registry_read_string_ext('\Environment','TEMP');
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>
|
|
The following functions exist:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>registry_write_string_ext(key,name,str)</b></tt>
|
|
Creates an entry in the key in the registry with the given name and string value.<br>
|
|
<tt><b>registry_write_real_ext(key,name,x)</b></tt>
|
|
Creates an entry in the key in the registry with the given name and real value.<br>
|
|
<tt><b>registry_read_string_ext(key,name)</b></tt>
|
|
Returns the string that the given name in the indicated key holds.
|
|
(The name must exist. Otherwise an empty string is returned.)<br>
|
|
<tt><b>registry_read_real_ext(key,name)</b></tt>
|
|
Returns the real value that the given name in the indicated key holds.
|
|
(The name must exist. Otherwise the number 0 is returned.)<br>
|
|
<tt><b>registry_exists_ext(key,name)</b></tt>
|
|
Returns whether the given name exists in the given key.<br>
|
|
<tt><b>registry_set_root(root)</b></tt>
|
|
Sets the root for the other routines. Use the following values:<br>
|
|
<blockquote>
|
|
<b>0</b> = HKEY_CURRENT_USER<br>
|
|
<b>1</b> = HKEY_LOCAL_MACHINE<br>
|
|
<b>2</b> = HKEY_CLASSES_ROOT<br>
|
|
<b>3</b> = HKEY_USERS
|
|
</blockquote>
|
|
</blockquote>
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
registry
|
|
|
|
registry_write_string()
|
|
registry_write_real()
|
|
registry_read_string()
|
|
registry_read_real()
|
|
registry_exists()
|
|
registry_write_string_ext()
|
|
registry_write_real_ext()
|
|
registry_read_string_ext()
|
|
registry_read_real_ext()
|
|
registry_exists_ext()
|
|
registry_set_root()
|
|
|
|
--> |