|
|
|
|
|
- Types of written data
- Handling the registry in Windows Vista (and later)
- Limitations of the RegistrySetValue function
RegistrySetValue (Function) Writes a value to a key in the Windows registry. Warning The key must exist in order to write a value to it. To create a key, use RegistryCreateKey.
ResWrite = RegistrySetValue("HKEY_CURRENT_USER\SOFTWARE\MyApp", ...
"Language", "English")
Sintaxis
Writing a value identified by its name into a registry Ocultar los detalles
<Result> = RegistrySetValue([<Access mode>, ] <Key path> , <Value name> , <Value> [, <Length>])
<Result>: Boolean - True if the value was written,
- False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Access mode>: Integer constant Modo de acceso al registro:
| | registryMode32 | Modo forzado para acceder al registro como un programa de 32 bits. | registryMode64 | Modo forzado para acceder al registro como un programa de 64 bits. | registryModeAuto (Valor predeterminado) | Modo de acceso automático al registro: - una aplicación de 32 bits que se ejecuta en un sistema de 32 bits manipula el registro como un programa de 32 bits.
- una aplicación de 32 bits que se ejecuta en un sistema de 64 bits manipula el registro desde la siguiente rama:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node - una aplicación de 64 bits que se ejecuta en un sistema de 64 bits manipula el registro como un programa de 64 bits.
|
<Key path>: Character string Full path of key to use. This key must exists in order for a value to be given to it. <Value name>: Character string Name of the value to write. If the value does not exist, it will be created. <Value>: Character string, integer, real or pointer Value to write. This value must not directly correspond to a numeric edit control for example. A typed variable must be used (declared as real, character string, ...). <Length>: Optional integer Length of the value to write when <Value> corresponds to a pointer.
Writing a typed value identified by its name into a registry Ocultar los detalles
<Result> = RegistrySetValue([<Access mode>, ] <Key path> , <Value name> , <Value> , <Type of value>)
<Result>: Boolean - True if the value was written,
- False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Access mode>: Integer constant Modo de acceso al registro:
| | registryMode32 | Modo forzado para acceder al registro como un programa de 32 bits. | registryMode64 | Modo forzado para acceder al registro como un programa de 64 bits. | registryModeAuto (Valor predeterminado) | Modo de acceso automático al registro: - una aplicación de 32 bits que se ejecuta en un sistema de 32 bits manipula el registro como un programa de 32 bits.
- una aplicación de 32 bits que se ejecuta en un sistema de 64 bits manipula el registro desde la siguiente rama:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node - una aplicación de 64 bits que se ejecuta en un sistema de 64 bits manipula el registro como un programa de 64 bits.
|
<Key path>: Character string Full path of key to use. This key must exists in order for a value to be given to it. <Value name>: Character string Name of the value to write. If the value does not exist, it will be created. <Value>: Character string, integer, real or pointer Value to write. If <Type of value> is used, the value is automatically converted to the right type <Type of value>: Character String constant Type of value to write: | | registryTypeBinary | Binary key. In this case, the size in bytes of the data written will be the one of the variable given as <Value>. | registryTypeInt | 4-byte integer key. | registryTypeInt_8 | 8-byte integer key. | registryTypeIntegerBigEndian | Big-endian integer key. | registryTypeMultiString | Multistring key. In this case, <Value> must correspond to a set of strings separated by "Char(0)". | registryTypeString | String key. | registryTypeStringEnv | String key containing environment variables. |
Writing a value identified by its index to a registry Ocultar los detalles
<Result> = RegistrySetValue([<Access mode>, ] <Key path> , <Value index> , <Value> [, <Length>])
<Result>: Boolean - True if the value was written,
- False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Access mode>: Integer constant Modo de acceso al registro:
| | registryMode32 | Modo forzado para acceder al registro como un programa de 32 bits. | registryMode64 | Modo forzado para acceder al registro como un programa de 64 bits. | registryModeAuto (Valor predeterminado) | Modo de acceso automático al registro: - una aplicación de 32 bits que se ejecuta en un sistema de 32 bits manipula el registro como un programa de 32 bits.
- una aplicación de 32 bits que se ejecuta en un sistema de 64 bits manipula el registro desde la siguiente rama:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node - una aplicación de 64 bits que se ejecuta en un sistema de 64 bits manipula el registro como un programa de 64 bits.
|
<Key path>: Character string Full path of key to use. This key must exists in order for a value to be given to it. <Value index>: Integer Index of the value to be written. <Value>: Character string, integer, real or pointer Value to write. <Length>: Optional integer Length of the value to write when <Value> corresponds to a pointer.
Writing a typed value identified by its index to a registry Ocultar los detalles
<Result> = RegistrySetValue([<Access mode>, ] <Key path> , <Value index> , <Value> , <Type of value>)
<Result>: Boolean - True if the value was written,
- False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Access mode>: Integer constant Modo de acceso al registro:
| | registryMode32 | Modo forzado para acceder al registro como un programa de 32 bits. | registryMode64 | Modo forzado para acceder al registro como un programa de 64 bits. | registryModeAuto (Valor predeterminado) | Modo de acceso automático al registro: - una aplicación de 32 bits que se ejecuta en un sistema de 32 bits manipula el registro como un programa de 32 bits.
- una aplicación de 32 bits que se ejecuta en un sistema de 64 bits manipula el registro desde la siguiente rama:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node - una aplicación de 64 bits que se ejecuta en un sistema de 64 bits manipula el registro como un programa de 64 bits.
|
<Key path>: Character string Full path of key to use. This key must exists in order for a value to be given to it. <Value index>: Integer Index of the value to be written. <Value>: Character string, integer, real or pointer Value to write. <Type of value>: Character String constant Type of value to write: | | registryTypeBinary | Binary key. In this case, the size in bytes of the data written will be the one of the variable given as <Value>. | registryTypeInt | 4-byte integer key. | registryTypeInt_8 | 8-byte integer key. | registryTypeIntegerBigEndian | Big-endian integer key. | registryTypeMultiString | Multistring key. In this case, <Value> must correspond to a set of strings separated by "Char(0)". | registryTypeString | String key. | registryTypeStringEnv | String key containing environment variables. |
Observaciones Types of written data If <Type of value> is not used, the data written into the registry has a specific type according to <Value>. If <Value> corresponds to: - a character string, the value written will be a string key (REG_SZ).
- an integer, the value written will be a REF_WORD.
- a real or a currency, the value written will be a binary key.
- a pointer, with <Length> corresponding to its length, the value written will be a binary key.
Handling the registry in Windows Vista (and later) In Windows Vista, if the UAC mechanism is enabled, you must have administrator rights to write to the "HKEY_LOCAL_MACHINE\SOFTWARE" key. If the user does not have sufficient rights, the UAC mechanism automatically redirects to the "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE" key. The purpose of this redirection is to ensure the compatibility of the applications. The keys written in this directory can be read by the application that has written them. Reminder When creating an executable, you can include a manifest to give the application administrator rights. Limitations of the RegistrySetValue function RegistrySetValue has no effect on "(default)" entries. These are specific entries. To reach these entries, the name of the key must be replaced with an empty string. Example: Don't: RegistrySetValue("HKEY_CLASSES_ROOT\.jar", "(default)", "myfile")
Do: RegistrySetValue("HKEY_CLASSES_ROOT\.jar", "myfile")
Clasificación Lógica de negocio / UI: Lógica de negocio
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|