tpra21
Active member
- Joined
- Oct 21, 2006
- Messages
- 26
- Programming Experience
- 1-3
I have a difficult question that I cannot find any information on. Say I want to get the current username value from the registry using the following code:
Now, how can I get the Username key value if I don't know the directory (Folder) names of the folders in the path. For example, if I don't know the name of the "Active Setup" folder in the path above, can I use the above path and plug a variable in.
Or, is there a function that can get me the registry key's path by using the key's (subkey's) name like "Username."
Thanks in advance, Adam
VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] userRegKey [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] RegistryKey = Registry.CurrentUser
userRegKey = userRegKey.OpenSubKey([/SIZE][SIZE=2][COLOR=#800000]"Software\\Microsoft\\Active Setup\\Installed Components\\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}"[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] value1 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2] = userRegKey.GetValue([/SIZE][SIZE=2][COLOR=#800000]"Username"[/COLOR][/SIZE][SIZE=2])
[/SIZE]
Now, how can I get the Username key value if I don't know the directory (Folder) names of the folders in the path. For example, if I don't know the name of the "Active Setup" folder in the path above, can I use the above path and plug a variable in.
Or, is there a function that can get me the registry key's path by using the key's (subkey's) name like "Username."
Thanks in advance, Adam