Hi there,

why does this code show no effect on the registry??
After running it, the values stored in the registry aren't changed.
I hate my pc for exactly doing what I tell him and not doing what I'm wanting
him to do ;-(

The values nMaxRemainingRecords are stored as DWORD in registry.
Private Sub SetAllMax()

Dim hKey As Long
Dim phkResult As Long
Dim lRes As Long
Dim pathName(9) As String
Dim rc As Long
Dim ValueData As Long
Dim ValueType As Long
Dim ValueLen As Long
Dim ValueName As String
Dim i As Integer

ValueName = "nMaxRemainingRecords"

For i = 1 To 9
pathName(i) = CStr("SOFTWARE\Projects\Archive" & CStr(i))

rc = RegOpenKeyEx(&H80000002, pathName(i), 0, &H1, hKey)
If rc = 0 Then
rc = RegQueryInfoKey(hKey, 0, 0, 0, 0, 0, 0, 0, 0, ValueLen, 0,
ValueLen = ValueLen + 1
ValueData = (CLng(lblMax(i).Caption))
rc = RegSetValueEx(hKey, ValueName, 0, REG_DWORD, ValueData, ValueLen)
End If
rc = RegCloseKey(hKey)
Next i

End Sub

The ValueData (=caption of lblMax(i)) is i.e. '200000'
In the registry the values are displayed in hexadecimal with decimal in brackets
( 0x00030d40 (200000))

What's wrong?

By the way: How can I figure out the errormessages of rc, if it is <> 0?
The only thing I know is that '0' means ERROR_SUCCESS.

So long!