guidway
asked on
RegSetValueEx error
I'm trying to write data to the registry using this function and it keeps returning error code 1450 (insufficient resources). Anyone know what would cause this?
My function looks like:
Public Function SaveSetting(ByVal Section as String, ByVal Key As String, ByVal Setting as String) as Boolean
Dim nRet as Long
Dim hKey as Long
Dim nResult as Long
nRet = RegCreateKeyEx(HKEY_CURREN T_USER, SubKey(Section), 0&, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, hKey, nResult)
If nRet = ERROR_SUCCESS Then
If Key = "*" then Key = vbNullString
nRet = RegSetValueEx(hKey, Key, 0&, REG_SZ, ByVal Setting, Len(Setting)) '<- here's where I get the error
Call RegCloseKey(hKey);
End If
SaveSetting = (nRet = ERROR_SUCCESS)
End Function
any ideas why I'm getting this error. My virtual disk space is at 1.5GB and I'm sure I have enough memory (1GB RAM), what other resources could be gone? I have nothing else running that uses a lot of resources.
My function looks like:
Public Function SaveSetting(ByVal Section as String, ByVal Key As String, ByVal Setting as String) as Boolean
Dim nRet as Long
Dim hKey as Long
Dim nResult as Long
nRet = RegCreateKeyEx(HKEY_CURREN
If nRet = ERROR_SUCCESS Then
If Key = "*" then Key = vbNullString
nRet = RegSetValueEx(hKey, Key, 0&, REG_SZ, ByVal Setting, Len(Setting)) '<- here's where I get the error
Call RegCloseKey(hKey);
End If
SaveSetting = (nRet = ERROR_SUCCESS)
End Function
any ideas why I'm getting this error. My virtual disk space is at 1.5GB and I'm sure I have enough memory (1GB RAM), what other resources could be gone? I have nothing else running that uses a lot of resources.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>so I'm doubtful it is a bug<<
let me clarify that statement. I mean I doubt it is a bug in Microsoft's code base since I have the latest service pack. I didn't mean I was doubtful it was a bug on my part. In fact, I'm about 95% sure it is since I seem to be the only one on the web having this error. ;)
let me clarify that statement. I mean I doubt it is a bug in Microsoft's code base since I have the latest service pack. I didn't mean I was doubtful it was a bug on my part. In fact, I'm about 95% sure it is since I seem to be the only one on the web having this error. ;)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've tried it everyway so far and everytime it gets to that line it gives the same error. I've even rebooted the computer to make sure it wasn't too many resources. I'm going to try increasing the size of the registry limit in win2k and see if that helps.
ASKER
that had no effect
ASKER
just tried the code for EDDYKT again and then it started working. I guess it may have been a copy error when I tried copying the code over. Anyway, I appreciate everyone's effort.
300 pts to EDDYKT
100 pts for fantasy1001
100 pts for dc197
thanks again
guid
300 pts to EDDYKT
100 pts for fantasy1001
100 pts for dc197
thanks again
guid
Thanks,
It is cool to know you have solve the problem.
~ fantasy ~
It is cool to know you have solve the problem.
~ fantasy ~
ASKER
thanks for the response, I tried that just now and got the same error. I have successfully been able to read from the registry (manually and programmatically) and I can write values to it manually using regedit but not programmatically. Anytime I try to use RegSetValueEx (or RegSetValueExString) I get the same error code... I'm on a Win2k SP3 O.S. using VB6SP5 so I'm doubtful it is a bug. It's frustrating that I can't get more info about what is causing the error. It is too generic... thanks again
guid