snerting
Programmer
- Oct 20, 2005
- 52
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?
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?