none
How to convert registry path to RegistryKey? RRS feed

  • Question

  • How to convert the path "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" to RegistryKey? the RegistryKey.ToString can convert to Registry path, how convert back to RegistryKey? thank you.
    Monday, November 25, 2019 1:31 AM

Answers

  • Hi,

    May be you can try to use RegistryKey.OpenSubKey Method.

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.registrykey.opensubkey?redirectedfrom=MSDN&view=netframework-4.8#Microsoft_Win32_RegistryKey_OpenSubKey_System_String_

    Hope it be helpful.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by gaxjyxq Wednesday, November 27, 2019 2:51 AM
    Monday, November 25, 2019 6:21 AM
    Moderator
  • Hi,

    Some important functions of RegistryKey are as follows:

    • GetValue ' to get value of a key
    • SetValue ' to set value to a key
    • DeleteValue ' to delete value of a key
    • OpenSubKey ' to read value of a subkey (read-only)
    • CreateSubKey ' to create new or edit value to a subkey
    • DeleteSubKey ' to delete a subkey
    • GetValueKind ' to retrieve the datatype of registry key

    For more details, please check in the link:

    https://www.codeproject.com/Articles/3389/Read-write-and-delete-from-registry-with-C

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by gaxjyxq Wednesday, November 27, 2019 2:51 AM
    Wednesday, November 27, 2019 1:37 AM
    Moderator

All replies