Discussion Locked

VB5 and Windows 9x registry

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

Please help. I developed a small program that manipulates the registry in a GUI this way our Admins don't have to weed through the registry manually, anyway. I have it working totally fin in Windows 2000, but it will not read or write to the Windows9x registry. Here's an example of the code:

I have a module with,
Public Function ReadKey(Value As String) As String

Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
r = b.RegRead(Value)
ReadKey = r
End Function

Then in the actual program to see the registered owner I would put:
Private Sub Command5_Click()
MsgBox "Registered owner of this system is: " & ReadKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Registeredowner")
End Sub

What is wrong with my code?

6 replies

by andrew

Are you sure the key exists?
The key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Registeredowner

has WindowsNT in it, which seems starnge for a 9x machine.

I think it should be:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Registeredowner

by tech010

Yes I understand, but this isn't the only entry I have in the program. I HAVE verified that the registry entries exist in Windows 9x. Any idead?

by andrew

Got me stumped.
Your code looks fine.

Is WSH installed on the 9x machine?
Is it the correct version of WSH?

I'm grasping at straws.

You can try running just the script (a VBS file) to eliminate any problems coming from VB.

Good luck.

This discussion is closed to new replies.