Discussion Locked

VB, Registry on NT, 2000

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am having trouble saving to the registry on win NT, 2000. I need to save to the HKEY_LOCAL_MACHINE key so I can't use VB's
SaveSetting, I need to use the API. The following code worked on 9x:

RegCreateKeyEx HKEY_LOCAL_MACHINE,
"Software\" & AppName" & "\" & key, 0, 0, 0, KEY_ALL_ACCESS, vbNull, hKey, lDummy)

RegSetValueEx hKey, "Left", 0, 1, ByVal sL, Len(sL)

I think it's permission issue, but can't get it to work on NT, 2000.

Thanks
Mike Walsh
mikew@augdev.com

5 replies

by brenlee1

You are right Mike, it is a permission issue. NT will not allow you to set any keys in the HKEY_LOCAL_MACHINE unless you have administrative access.

You can, however, write to HKEY_CURRENT_USER on both Win 9x/NT/2000.

This discussion is closed to new replies.