General information
Title:
How do I get a Registry Key Value?
My goal is to get a string telling me who is currently logged on to WindowsNT. I have found a Registry Key (HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/Winlogon/DefaultUserName) that I believe holds this information.
There might be an easier way but what I have done so far is add the Registry.vcx to my project and copied a registry object to my form. I am attemping to figure out how to use it but there isn't much help available that I've found. It seems I should be using the GetKeyValue method or the GetRegKey method.
I have tried this code:
pUser=thisform.registry1.getkeyvalue('HKEY_LOCAL_MACHINE/ ... /DefaultUserName')
pUser is set to equal -105 so I'm obviously doing something wrong. Could someone please tell me how to set up the registry object to return the UserID or give me an easier way of getting it?
Thanks in advance,
Justin
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only