Thông báo lỗi "Error accessing the system registry" xảy ra khi Biên dịch project ra file exe hay dll, hoặc xảy ra thình lình trong VB6. Cách giải quyết như sau:
Cách 1:
Select the Microsoft Visual Basic 6.0 shortcut from the Start menu and right-click on it. Select Properties, and the property sheet for the shortcut will be displayed. Next, click on the Compatibility tab. It is recommended that you make the following changes:
1. Enable compatibility mode and select Windows XP (Service Pack 2) .....2. Check the "Disable visual themes" option .....
3. Check the "Disable desktop composition" option.....
4. Check the "Run this program as an administrator" option
Click on OK to save the changes. When you run Visual Basic, a User Account Control (UAC) dialog will be displayed, asking you to confirm that you wish to execute the program. This is because it's now running with elevated privileges. You may also get a message that the color scheme has been changed to Windows Vista Basic. The Aero interface will be temporarily disabled until you close the IDE, which will resolve the performance issues with the form designer.
Cách 2:
When to Start, Microsoft Visual Studio then right clicked on the VB6 shortcut and selected run as administrator. Now it works.
Cách 3:
Another update:
iTunes (and other apps yet to come) may also cause this problem in Win7.
This is because it runs a service which creates registry keys under the SYSTEM account.
When VB tries to enumerate the keys under HKCR\TypeLib it fails and gives the error because the user running VB6.EXE (even if it set to run as administrator) does not automatically have READ rights to the key. At that point you get the "Error accessing the system registry" dialog.
To workaround/fix this:
1. Download Procmon and PsExec from sysinternals.
2. Run Procmon and add a "ProcessName" filter with VB6.EXE as the process name.
3. Then Select Project->References. And the error dialog should pop up.
4. Switch to procmon and scroll to the end of the events list - you're looking for the last "ACCESS_DENIED" message for opening a registry key under HKCR\TypeLib.
5. Thats the first key you need to change permissions on - so you'll need to run regedit in the same account context that the keys were created in - the SYSTEM account. to do this install psexec on the windows PATH somewhere then run:
psexec -i -d -s c:\windows\regedit.exe
(obviously change the path if yours is different)
this will run regedit through the SYSTEM account.
*You can verify that even the administrator account does NOT have permission to edit these keys by running regedit through a Start->Run dialog as this elevates the priv' level to administrator.*
6. Find the key you identified in step 4 - right click it and select Permissions.
7. Find the current logged on user that you use to run VB6 with and add them with full control to the permissions list.
8. Repeat steps 3-7 because there may be more keys that exhibit this behaviour, until the Project->References dialog appears in VB6 without error.
You could also open the .vbp in notepad to see the references if you're stuck and dont have time to do the above.....
iTunes (and other apps yet to come) may also cause this problem in Win7.
This is because it runs a service which creates registry keys under the SYSTEM account.
When VB tries to enumerate the keys under HKCR\TypeLib it fails and gives the error because the user running VB6.EXE (even if it set to run as administrator) does not automatically have READ rights to the key. At that point you get the "Error accessing the system registry" dialog.
To workaround/fix this:
1. Download Procmon and PsExec from sysinternals.
2. Run Procmon and add a "ProcessName" filter with VB6.EXE as the process name.
3. Then Select Project->References. And the error dialog should pop up.
4. Switch to procmon and scroll to the end of the events list - you're looking for the last "ACCESS_DENIED" message for opening a registry key under HKCR\TypeLib.
5. Thats the first key you need to change permissions on - so you'll need to run regedit in the same account context that the keys were created in - the SYSTEM account. to do this install psexec on the windows PATH somewhere then run:
psexec -i -d -s c:\windows\regedit.exe
(obviously change the path if yours is different)
this will run regedit through the SYSTEM account.
*You can verify that even the administrator account does NOT have permission to edit these keys by running regedit through a Start->Run dialog as this elevates the priv' level to administrator.*
6. Find the key you identified in step 4 - right click it and select Permissions.
7. Find the current logged on user that you use to run VB6 with and add them with full control to the permissions list.
8. Repeat steps 3-7 because there may be more keys that exhibit this behaviour, until the Project->References dialog appears in VB6 without error.
You could also open the .vbp in notepad to see the references if you're stuck and dont have time to do the above.....
Link: https://www.vbforums.com/showthread.php?545433-RESOLVED-Sudden-quot-Error-accessing-the-system-registry-quot