RegistrySet PowerScript function
Description
Sets the value for a key and value name in the system registry.
If the key or value name does not exist, RegistrySet creates
a new key or name and sets its value.
Syntax
|
1 |
<span>RegistrySet</span> ( <span>key</span>, <span>valuename</span>, <span>valuetype</span><span>, value</span> ) |
|
Argument |
Description |
|---|---|
|
key |
A string whose value names the key in To uniquely identify a key, specify the list of parent keys If key does not exist in the registry, RegistrySet creates |
|
valuename |
A string containing the name of a value If valuename does not exist in the registry, RegistrySet causes |
|
valuetype |
A value of the RegistryValueType enumerated
|
|
value |
A variable corresponding to the datatype |
Return Values
Integer. Returns 1 if it succeeds and
-1 if an error occurs. An error is returned if the datatype of valuevariable does
not correspond to the datatype specified in valuetype.
Usage
Long string values (more than 2048 bytes) should be stored
as files and the file name stored in the registry.
|
Item |
Description |
||||
|---|---|---|---|---|---|
|
Key |
An element in the registry. A key is There are four root strings:
A key is uniquely identified by the list of parent keys above it.
|
||||
|
Value name |
The name of a value belonging to the |
||||
|
Value type |
A value identifying the datatype of a |
||||
|
Value |
A value associated with a value name |
Examples
This example sets a value for the key Fonts and
the value name Title:
|
1 |
<span>RegistrySet</span>( & |
|
1 |
"HKEY_LOCAL_MACHINESoftwareMyAppFonts", & |
|
1 |
"Title", RegString!, sle_font.Text) |
This statement sets a value for the key Fonts and
the value name NameOfEntryNum:
|
1 |
ulong ul_num |
|
1 |
<span>RegistrySet</span>( & |
|
1 |
"HKEY_USERSMyApp.SettingsFonts", & |
|
1 |
"NameOfEntryNum", RegULong!, ul_num) |