snerting
Programmer
- Oct 20, 2005
- 52
This is probably not an Access-specific problem, but it's VB6 implementation of advapi32.dll so here it goes:
I'm using a registry setting to control how the access app should read data. The registry setting is controlled by another application. However, at some random intervals, the data read from registry is bugus. It seems to be a collection of spaces and line breaks, while the string in registry really is something else. If I run regedit and just double click the setting in question (without chanting anything), access will read it fine again.
The code:
Dim lResult As Long
Dim lKeyValue As Long
Dim sValue As String
Dim lValueLength As Long
Dim lDataTypeValue As Long
sValue = Space$(2048)
lValueLength = Len(sValue)
lResult = RegOpenKey(dataset.HKEY_CURRENT_USER, "software\\Foo\\bar", lKeyValue)
lResult = RegQueryValueEx(lKeyValue, "foobar", 0&, lDataTypeValue, sValue, lValueLength)
sValue = Left$(sValue, lValueLength - 1)
Any ideas on why this is happening?
I'm using a registry setting to control how the access app should read data. The registry setting is controlled by another application. However, at some random intervals, the data read from registry is bugus. It seems to be a collection of spaces and line breaks, while the string in registry really is something else. If I run regedit and just double click the setting in question (without chanting anything), access will read it fine again.
The code:
Dim lResult As Long
Dim lKeyValue As Long
Dim sValue As String
Dim lValueLength As Long
Dim lDataTypeValue As Long
sValue = Space$(2048)
lValueLength = Len(sValue)
lResult = RegOpenKey(dataset.HKEY_CURRENT_USER, "software\\Foo\\bar", lKeyValue)
lResult = RegQueryValueEx(lKeyValue, "foobar", 0&, lDataTypeValue, sValue, lValueLength)
sValue = Left$(sValue, lValueLength - 1)
Any ideas on why this is happening?