AddRegKey Method

Top  Previous  Next

Lokas Software AWinstall Online Help
Start Page
Engine Functionality
Tasks and Actions
Installer Variables
Reading from Registry and Environment
Tips And Tricks
Frequently Asked Questions
Installer Actions
Extract Files with Folders
Register COM DLL
Register COM Type Library
Create Shortcuts and Start Menu Items
Register Fonts
Add Registry Keys
Add Keys from .reg file
Add Keys from System Registry
Run External Programs
Add Uninstall Shortcut
Setup Builder Interface
Main Windows
Property Pane
Project Tree
Event Log
Menu bar commands
File
Edit
View
Project
Task
Help
Toolbars
Standard
Actions
Extending your setups
Script Actions
Installer Object
AddRegKey Method
CancelInstall Method
CopyFile Method
CreateObject Method
CreateShortcut Method
RegisterFont Method
RegisterServer Method
RegisterTypeLib Method
RunProgram Method
ShowMessage Method
Variables Method
VersionMajor Property
VersionMinor Property
General Information
Product Registration
History of Changes
  download AWinstall

Creates a registry value or changes the value of an existing value-name in the Windows Registry.

[VBScript]

Installer.AddRegKey Key, Type, Value

 

[JScript]

Installer.AddRegKey(Key, Type, Value);

Parameters

Key

String value indicating the registry value-name you want to create or change.

Type

The numeric constant identifying the registry key type (see below).

Value

The key value.

Remarks

To specify the predefined registry hive, use the following abbreviations:

"HKLM" for HKEY_LOCAL_MACHINE

"HKCR" for HKEY_CLASSES_ROOT

"HKCU" for HKEY_CURRENT_USER

"HKCC" for HKEY_CURRENT_CONFIG

Installer variables are supported in the keys and string values. To emit the value of installer variable MyVar, use the form ${MyVar}.

The following types are supported:

Constant

Windows API Name

Description

1

REG_SZ

String type. Installer variables are supported in string values.

2

REG_EXPAND_SZ

7

REG_MULTI_SZ

3

REG_BINARY

Binary data (an array of bytes). Use Arrays in VBScript and strings in JScript (see the example).

4

REG_DWORD

DWORD value (4-bytes integer).

Uninstall support

This action supports automatic uninstallation.

Example (VBScript)

Installer.AddRegKey "HKLM\Software\${CompanyName}\${ProductName}\StringValue", _

    1, "${CompanyName}"

Installer.AddRegKey "HKLM\Software\${CompanyName}\${ProductName}\DwordValue", _

    4, &HBADCAFE

' note that VBScript supports SAFEARRAYs, so you may use Array's for binary data

Dim s

s = Array( &HB, &HA, &HD, &HC, &HA, &HF, &HE )

Installer.AddRegKey "HKLM\Software\${CompanyName}\${ProductName}\BinaryValue", _

    3, s

Example (JScript)

Installer.AddRegKey("HKLM\\Software\\${CompanyName}\\${ProductName}\\StringValue"

    1, "${CompanyName}" );

Installer.AddRegKey("HKLM\\Software\\${CompanyName}\\${ProductName}\\DwordValue"

    4, 0xBADCAFE );

// JScript does not support SAFEARRAYs, so you should use strings for binary data

var s = String.fromCharCode( 0xB, 0xA, 0xD, 0xC, 0xA, 0xF, 0xE );

Installer.AddRegKey("HKLM\\Software\\${CompanyName}\\${ProductName}\\BinaryValue"

    3, s );

© 2007 Lokas Software