Function Reference


RegEnumVal

Reads the name of a value according to its instance.

RegEnumVal ( "keyname", instance )

Parameters

keyname The registry key to read.
instance The 1-based value instance to retrieve

Return Value

Success: the requested registry value. @extended is set to the type of the value.
Failure: sets the @error flag to non-zero.
@error: 1 = unable to open requested key
 2 = unable to open requested main key
 3 = unable to remote connect to the registry
-1 = unable to retrieve requested value name (value instance out of range)

Remarks

A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").

When running on 64-bit Windows if you want to enum a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.

Related

RegDelete, RegEnumKey, RegWrite

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
        Local $i, $sVar, $sWow64 = "", $sEnumVal = "Under AutoIt3 key." & @CRLF & @CRLF
        Local $aRegValueType[12] = ["REG_NONE", "REG_SZ", "REG_EXPAND_SZ", "REG_BINARY", _
                        "REG_DWORD_LITTLE_ENDIAN", "REG_DWORD_BIG_ENDIAN", "REG_LINK", _
                        "REG_MULTI_SZ", "REG_RESOURCE_LIST", "REG_FULL_RESOURCE_DESCRIPTOR", _
                        "REG_RESOURCE_REQUIREMENTS_LIST", "REG_QWORD_LITTLE_ENDIAN"]

        ; X64 running support
        If @AutoItX64 Then $sWow64 = "\Wow6432Node"

        For $i = 1 To 100
                $sVar = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", $i)
                If @error <> 0 Then ExitLoop
                $sEnumVal &= "# " & $i & ":" & StringLeft($aRegValueType[@extended] & "                         ", 31) & $sVar & @CRLF
        Next

        MsgBox($MB_SYSTEMMODAL, "RegEnumVal example", $sEnumVal)

EndFunc   ;==>Example