Official Content

Enters information in the Windows registry.

Syntax

WriteRegKey( path,  value )

Where:
path
   The path where the value will be saved. It’s character type.

value
   The value to configure in the specified path. It’s also character type.

Type Returned:
Numeric

Scope

Objects: Procedure, Transaction, Web Panel, Work Panel
Generators: .NET, Java,Visual FoxPro (up to GeneXus X Evolution 3)

Description

This function allows having an advanced handling of the Windows registry, so it’s recommended to be used with caution.

It may be used to save the information about the location of the GeneXus application local database, which then will be accessed with the Keyword RegKey (this method is the one that substitutes the file with INI extension to indicate the local database location).

If the returned value is 0, it means that there weren’t operation errors. If it’s different from 0, it means that there were errors.

Note:

It isn’t possible to save any section of the Windows registry.  It’s only allowed to save values in the following folders:

HKEY_LOCAL_MACHINE\Software
HKEY_USERS\Software
HKEY_CURRENT_CONFIG\Software

In Windows NT and Windows 2000 it’s necessary to have permissions to update HKEY_CURRENT_CONFIG and HKEY_LOCAL_MACHINE

Samples

The following example shows the use of these functions from GeneXus.

Event Start
   &path = 'HKEY_LOCAL_MACHINE\Software\Company'
   &Value = 'C:\Program Files\Application'
EndEvent  // Start

Event 'Save'
   &Ret = WriteRegKey(&Path, &Value) 
EndEvent  // 'save'

Event 'Read'
   &String = ReadRegKey(&Path) 
EndEvent  // Enter

A new String Value under the ‘HKEY_LOCAL_MACHINE\Software’ coed is created, whose name is ‘Company’ and its associated value is ‘C:\Program Files\Application’.

See Also

ReadRegKey Function







 

Last update: 2026 | © GeneXus. All rights reserved. GeneXus Powered by Globant